Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Adding Headers to the Dynamically Created Datagrid.. (http://www.velocityreviews.com/forums/t780167-adding-headers-to-the-dynamically-created-datagrid.html)

jayanth.vishnuvardhan@gmail.com 09-05-2007 04:55 PM

Adding Headers to the Dynamically Created Datagrid..
 
Hi,

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"
dgitem.Cells.Add(mycell12)

Dim mycell7 As New TableCell
mycell7.Text = "Most Recent Payment"
mycell7.HorizontalAlign = HorizontalAlign.Center
mycell7.ColumnSpan = "4"
mycell7.CssClass = "LoanSummaryGridHeadColor2"
dgitem.Cells.Add(mycell7)

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


marss 09-06-2007 06:51 AM

Re: Adding Headers to the Dynamically Created Datagrid..
 
On 5 , 19:55, jayanth.vishnuvard...@gmail.com wrote:
> Hi,
>
> 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"
> dgitem.Cells.Add(mycell12)
>
> Dim mycell7 As New TableCell
> mycell7.Text = "Most Recent Payment"
> mycell7.HorizontalAlign = HorizontalAlign.Center
> mycell7.ColumnSpan = "4"
> mycell7.CssClass = "LoanSummaryGridHeadColor2"
> dgitem.Cells.Add(mycell7)
>
> 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


Look here
http://marss.co.ua/MergingGridViewHeaderColumns.aspx

Regards,
Mykola



All times are GMT. The time now is 02:57 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.