PC Review


Reply
Thread Tools Rate Thread

The dreaded ASP Datagrid...dynamically created controls being lost on a postback.... ?

 
 
news.zen.co.uk
Guest
Posts: n/a
 
      1st Apr 2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically created Datagrid not found on postback Jeff User Microsoft ASP .NET 0 15th Nov 2006 06:12 PM
How to get value on postback Dynamically Created controls by javascript Amit Maheshwari Microsoft ASP .NET 6 6th Mar 2006 12:42 PM
ASP.NET Persisting dynamically created validation controls across postback Chad Smith Microsoft Dot NET 1 8th Jan 2006 08:32 PM
State of Dynamically Created controls on PostBack? Amelyan Microsoft ASP .NET 5 1st Jun 2005 08:01 PM
Dynamically created controls not accessible on postback Tim Greenwood Microsoft ASP .NET 1 13th May 2005 12:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:21 AM.