I programatically generate radgrid through PlaceHolder.
I also created a sub called "RadGrid1_ItemDataBound".
but how do I execute it since there is no property "OnItemDataBound" in runtime.
I need to be able to click on the link from boundLinkColumn and display radwindow.
The ItemDataBound event will be fired only when the Grid is bound to a DataSource. You can add the event handler for the ItemDataBound event to RadGrid as shown below.
CS:
RadGrid1.ItemDataBound += new GridItemEventHandler(RadGrid1_ItemDataBound);
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs)
If e.Item.ItemType = GridItemType.AlternatingItem Or e.Item.ItemType = GridItemType.Item Then
Dim item As Telerik.WebControls.GridDataItem
item = e.Item
item("CustomerID").Text = "Telerik"
End If
End Sub
But how do I create event handler in aspx since I added the control from the code behind?
is there something like this?
RadGrid1.OnItemDataBound="RadGrid1_ItemDataBound" Me.PlaceHolder1.Controls.Add(RadGrid1)
From what I understood you are creating the RadGrid in the code behind and trying to set the event handler for the ItemDataBound event in the aspx. As far as I know adding an event handler in the code behind for a statically declared Grid is possible but the reverse is not achievable. Programmatic creation