Hi Guys,
Using VB .NET 2003 and ASP1.1, I have a Datagrid embedded in an ASP page. In the processing of the ItemDataBound event I dynamically create a new Datagrid control within the Cell of the Parent (this refelect GUI'wise a Parent Child related data). I also add Handlers to the sub datagrid using AddHandler to handle the EditCommandColumn as well as ItemDataBound.
Parent Datagrid
------------------------------------------------------------------------------------------
|Bound Column|BoundColumn|TemplateColumn |
| | | Dyanmically Created Datagrid|
| | | ---------------------------------------- |
| | | | Bound Col|Bound Col|Edit| |
| | | ---------------------------------------- |
------------------------------------------------------------------------------------------
This is all fine, with one exception (as ever!)....
When the Edit button is click on the Edit button of the Dynamically Created grid, the Dynamically Created grid disappears! Guess it's something to do with PostBack, my Page_Load looks like this:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
InvoiceBindData()
End If
End Sub
Guess because the sub grid is created in the ItemBoundEvent (which isn't being called), it's effectively lost when the page is regenerated. If I comment out the IsPostBack condition the Handler for the Edit item of the sub-datagrid isn't called. Am getting a bit desperate and am thoroughly confused. Have searched the WEB and looked at Datagrid girl's WEB Site.
Any help or pointers, really appreciated!
Thanks,
Shaun