Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Adding Headers to the Dynamically Created Datagrid..

Thread Tools

Adding Headers to the Dynamically Created Datagrid..
Posts: n/a

It would be great if someone suggests me on how to append "Header"
information for the dynamically created datagrids?

Here is my situation:-

I'm creating dynamic datagrids based on the data coming from database.
so far so good.. Then after that I need to create "Headers"
information like "payment","due date" etc.. information to each data
grid as headers.

I used Datagrid Prerender Method but it always adding the "headers" to
the last created dynamic datagrid. I'm not sure why it's doing like
tha, but i assume as it's Prerender it is only called once even though
we created dynamically.

Here is Code snippet:-

Protected Sub DynamicDGrid_PreRender(ByVal sender As Object, ByVal e
As System.EventArgs) Handles DynamicDGrid.PreRender

Dim dgitem As New DataGridItem(0, 0, ListItemType.Header)

Dim mycell12 As New TableCell
mycell12.Text = "Next Payment"
mycell12.HorizontalAlign = HorizontalAlign.Center
mycell12.ColumnSpan = "2"
mycell12.CssClass = "LoanSummaryGridHeadColor3"

Dim mycell7 As New TableCell
mycell7.Text = "Most Recent Payment"
mycell7.HorizontalAlign = HorizontalAlign.Center
mycell7.ColumnSpan = "4"
mycell7.CssClass = "LoanSummaryGridHeadColor2"

DynamicDGrid.Controls(0).Controls.AddAt(0, dgitem)

End sub

If you observe the above method the last statement says
"DynamicDGrid.Controls(0).Controls.AddAt(0, dgitem)".

Is this correct statement or am I Missing anything?

My o/p should be like this:-

Header 1 Header 2
Col1 Col2 Col3 Col4 Col5 Col6
Data data data Data Data data

Header 1 Header 2
Col1 Col2 Col3 Col4 Col5 Col6
Data data data Data Data data

Reply With Quote

Thread Tools

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
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
Adding Headers to the Dynamically Created Datagrid.. ASP .Net Web Controls 1 09-06-2007 06:51 AM
Managing ViewState of a dynamically created Custom Composite Server Control -(where the original is also dynamically created) dickster ASP .Net Building Controls 0 12-08-2005 09:32 AM
adding sub group headers dynamically for datagrid in prerender Anand ASP .Net Datagrid Control 0 11-16-2004 05:37 PM
Adding event handler for dynamically created controls =?Utf-8?B?QW5kcmV3IFdpZWQ=?= ASP .Net 3 04-25-2004 07:36 PM