// Event Clone's button Click public void Clone_Click(object sender, EventArgs e) { if (this.Grid == null) { return; } int lKeyID = 0; int count = 0; foreach (TreeListDataItem item in this.Grid.SelectedItems) { if (item.Selected) { lKeyID = int.Parse(item.GetDataKeyValue(this.Grid.DataKeyNames[0]).ToString()); count++; } } switch (count) { case 0: ShowErrorMes("Vui lòng chọn 1 hàng để sao chép"); break; case 1: string page = Page.Request.QueryString["module"]; TNavigation.ClonePage(page, lKeyID); break; default: // Have more than 1 Row be selected ! ShowErrorMes("Chỉ được phép chọn tối đa 1 dòng để sao chép"); break; } }
// Event in Row. protected void RadGrid1_ItemCommand(object sender, TreeListCommandEventArgs e) { int lKeyID = 0; string lEvent = e.CommandName; string page = ""; switch (lEvent) { case ActRow.Delete: lKeyID = int.Parse(e.CommandArgument.ToString()); int lRowDeleted = DeleteByID(lKeyID); // Delete Row ShowSuccessMes(lRowDeleted + " dòng đã được xoá"); // show Mes. LoadData(); break; case ActRow.Edit: lKeyID = int.Parse(e.CommandArgument.ToString()); page = Page.Request.QueryString["module"]; TNavigation.EditPage(page, lKeyID); break; case ActRow.Clone: lKeyID = int.Parse(e.CommandArgument.ToString()); page = Page.Request.QueryString["module"]; TNavigation.ClonePage(page, lKeyID); break; } }