I am using a grid control witch is created dynamically from server but am facing a problem.The delete button never fires the event DeleteCommand.Below is my c# code
and this is the asp code
Can someone help me with my problem.Thank you
private void GridPowerControl(){ RadGrid1.Columns.Clear(); RadGrid1.PageSize = 5; RadGrid1.AllowPaging = true; RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; RadGrid1.AutoGenerateColumns = false; RadGrid1.ShowStatusBar = true; RadGrid1.MasterTableView.EditFormSettings.UserControlName = ControlS.POWER_CONTROL; RadGrid1.MasterTableView.EditFormSettings.EditFormType = Telerik.Web.UI.GridEditFormType.WebUserControl; RadGrid1.MasterTableView.PageSize = GlobalParams._PageRowNum; RadGrid1.MasterTableView.Width = Unit.Percentage(100); RadGrid1.MasterTableView.CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.Top; RadGrid1.MasterTableView.DataKeyNames = new string[] { "ID" }; GridEditCommandColumn editColumn; editColumn = new GridEditCommandColumn(); editColumn.UniqueName = "EditCommandColumn"; RadGrid1.MasterTableView.Columns.Add(editColumn); GridButtonColumn deleteButton; deleteButton = new GridButtonColumn(); deleteButton.UniqueName = "Delete"; deleteButton.Text = Resources.Global.DELETE; deleteButton.CommandName = "Delete"; RadGrid1.MasterTableView.Columns.Add(deleteButton); GridBoundColumn boundColumn; boundColumn = new GridBoundColumn(); boundColumn.DataField = "Name"; boundColumn.UniqueName = "Name"; boundColumn.HeaderText = Resources.Global.NAME; RadGrid1.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "Tag"; boundColumn.UniqueName = "Tag"; boundColumn.HeaderText = Resources.Global.TAG; RadGrid1.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "Info"; boundColumn.UniqueName = "Info"; boundColumn.HeaderText = Resources.Global.INFO; RadGrid1.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "Geotag"; boundColumn.UniqueName = "Geotag"; boundColumn.HeaderText = Resources.Global.GEO_TAG; RadGrid1.MasterTableView.Columns.Add(boundColumn);}protected void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e){ string Test = string.Empty;}and this is the asp code
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowPaging="True" CssClass="RadGrid" AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand" OnDeleteCommand="RadGrid1_DeleteCommand"> <MasterTableView> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> </MasterTableView> <ClientSettings> <ClientEvents OnRowDblClick="RowDblClick" /> </ClientSettings></telerik:RadGrid>