protected void myManageGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "MoveUp" || e.CommandName == "MoveDown" || e.CommandName == "Delete") { int index = Convert.ToInt32(e.CommandArgument); ManageGridView mygrid = (ManageGridView)sender; Label lblId = mygrid.Rows[index].FindControl(STR_LABEL_ID) as Label; int Id = DataConvert.GetInt32(lblId.Text); //int Seq = Convert.ToInt32(myManageGridView.DataKeys[index].Value); Label lblSequence = mygrid.Rows[index].FindControl(STR_SEQUENCE_ID) as Label; int Seq = DataConvert.GetInt32(lblSequence.Text); CommonProcess cm = new CommonProcess(); switch (e.CommandName) { case "MoveUp": cm.ExchangeSequence(ManageTable, ManageKey, Id, Seq, (isdesc == false) ? true : false); break; case "MoveDown": cm.ExchangeSequence(ManageTable, ManageKey, Id, Seq, (isdesc == false) ? false : true); break; case "Delete": DeleteById(ManageTable, ManageKey, Id); break; default: break; } getData(); } }