Good morning,
I have a problem in the association of an event to a dynamically added control on the grid.
The control is of type ImageButton.
I insert this control in a column of type GridTemplateColumn.
I used the method ItemCreated and / or ItemDataBound but neither of them solves my problem.
This is the code (in ItemCreated and / or ItemDataBound)
The function is this :
This is the RadGrid..
When I click on ImageButton i don't enter in the event...
In this Grid there is another Imagebutton fixed...(you can see in RadGrid) btnStatus... This button is ok..
I don't know Why...
Idea ?
Thanks,
Marco
I have a problem in the association of an event to a dynamically added control on the grid.
The control is of type ImageButton.
I insert this control in a column of type GridTemplateColumn.
I used the method ItemCreated and / or ItemDataBound but neither of them solves my problem.
This is the code (in ItemCreated and / or ItemDataBound)
ImageButton btn = new ImageButton(); btn.ToolTip = string.Format("{0} - {1}", split[4], split[1]); btn.ID = string.Concat(split[4], "_", split[0]); btn.ImageUrl = string.Format("~/Images/16x16/Phase/{0}.png", split[2]); btn.Click += new ImageClickEventHandler(ManageItem); ((GridDataItem)e.Item).Cells[codiceTiplogia + 4].Controls.Add(btn);The function is this :
protected void ManageItem(object sender, ImageClickEventArgs e) { ..... }This is the RadGrid..
<telerik:RadGrid ID="gvPartite" runat="server" Skin="Office2010Blue" AutoGenerateColumns="false" Visible="false" OnItemCreated="gvPartite_ItemCreated" OnItemDataBound="gvPartite_ItemDataBound"> <MasterTableView> <Columns> <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true"> <ItemTemplate> <asp:ImageButton ID="btnStatus" runat="server" OnClick="ManageItem" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="INFO" HeaderStyle-Font-Bold="true"> <ItemTemplate> (personal code) </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="ARB" UniqueName="1"> <ItemTemplate> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid>In this Grid there is another Imagebutton fixed...(you can see in RadGrid) btnStatus... This button is ok..
I don't know Why...
Idea ?
Thanks,
Marco