protected void tvTrainTypeChangeCallBack_Callback(object sender, CallBackEventArgs e) { TrainTypeBLL objTrainType = new TrainTypeBLL(); TrainType traintype = objTrainType.GetTrainTypeInfo(int.Parse(e.Parameters[0])); int cout = traintype.ParentID == 0 ? tvTrainType.Nodes.Count : tvTrainType.FindNodeById(traintype.ParentID.ToString()).Nodes.Count; if (e.Parameters[1] == "MoveUp") { if (traintype.OrderIndex <= cout && traintype.OrderIndex >= 2) { traintype.OrderIndex--; objTrainType.UpdateTrainType(traintype); traintype = objTrainType.GetTrainTypeInfo(int.Parse(tvTrainType.FindNodeById(e.Parameters[0]).PreviousSibling.ID)); traintype.OrderIndex++; objTrainType.UpdateTrainType(traintype); } } if (e.Parameters[1] == "MoveDown") { if (traintype.OrderIndex <= cout - 1 && traintype.OrderIndex >= 1) { traintype.OrderIndex++; objTrainType.UpdateTrainType(traintype); traintype = objTrainType.GetTrainTypeInfo(int.Parse(tvTrainType.FindNodeById(e.Parameters[0]).NextSibling.ID)); traintype.OrderIndex--; objTrainType.UpdateTrainType(traintype); } } if (e.Parameters[1] == "Insert") { IList <RailExam.Model.TrainType> objList = objTrainType.GetTrainTypeByWhereClause("1=1", "Train_Type_ID desc"); hfMaxID.Value = objList[0].TrainTypeID.ToString(); hfMaxID.RenderControl(e.Output); } else if (e.Parameters[1] == "Delete") { hfMaxID.Value = e.Parameters[2]; hfMaxID.RenderControl(e.Output); } tvTrainType.Nodes.Clear(); BindTrainTypeTree(); tvTrainType.RenderControl(e.Output); }