473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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

Nov 21 '05 #1
0 1326

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
2
by: kgs | last post by:
I dynamically added a DropDownListBox to a footer of datagrid on itemcreated event. In which event in postback can i access the selected item. Interesting thing i noted that even though i create...
2
by: Colin McGuigan | last post by:
This is a translation of an ASP page to ASP.Net. First, the background: The goal is to have a grid of different settings for the application -- think something along the lines of the Property...
18
by: Julia Hu | last post by:
Hi, I have a datagrid, and in different rows I need to programmatically bind different type of controls and load data into these controls. For example,in the first row I need to bind data into a...
2
by: Joanne | last post by:
Hi, I have an "interesting" problem with UserControls in a datagrid and I'm desperate for your help as I work alone and have no-one else to ask. It is quite complicated but I'll try to keep it...
1
by: Marcus | last post by:
I have a problem maybe one of you could help me with. I've created a data entry screen with lots of dynamically-created client-side controls. I create HTML texboxes client-side by assigning a...
1
by: Reg | last post by:
Hello, I already posted a question about a problem with a datagrid. ("Lost columns in datagrid", thanks for JohnH) I dynamically create columns in a datagrid and the user selects lines (column...
3
by: SMai24 | last post by:
created 4 boundcolumns dynamically or programmatically and bind them to a datasource, when client click on a button before posting back to the server, i am trying to extract the data from the...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.