Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   Programatically add column (http://www.velocityreviews.com/forums/t760203-programatically-add-column.html)

Audun Simonsen 02-02-2004 09:30 AM

Programatically add column
 
Hi.

My problem is how to add several columns with a checkbox programatically to
a datagrid.

Anybody with some pointers?


-as



Saravana [MVP] 02-03-2004 04:44 AM

Re: Programatically add column
 
Check out this articles,
Creating Datagrid Templated Columns Dynamically
http://www.dotnetbips.com/displayarticle.aspx?id=84
http://www.dotnetbips.com/displayarticle.aspx?id=85


--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com



"Audun Simonsen" <a@a.a> wrote in message
news:e9qv88W6DHA.2644@TK2MSFTNGP11.phx.gbl...
> Hi.
>
> My problem is how to add several columns with a checkbox programatically

to
> a datagrid.
>
> Anybody with some pointers?
>
>
> -as
>
>




Audun Simonsen 02-03-2004 02:55 PM

Re: Programatically add column
 

"Saravana [MVP]" <saravank@sct.co.in.nospam> wrote in message
news:%23BU6oAh6DHA.2628@TK2MSFTNGP10.phx.gbl...
> Check out this articles,
> Creating Datagrid Templated Columns Dynamically
> http://www.dotnetbips.com/displayarticle.aspx?id=84
> http://www.dotnetbips.com/displayarticle.aspx?id=85
>
>


Thanks, those examples helped me a lot, and I'm now able to add some
columns.

But, how can I make those columns persistant? They dissapear when I do a
postback of the page.

I add the column in the Page_Load method, according to the example in
http://www.dotnetbips.com/displayarticle.aspx?id=85:


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Dim tc1 As TemplateColumn

tc1 = New TemplateColumn()
tc1.ItemTemplate = New CTemplateColumn("Include")
tc1.HeaderText = "First name"
dgValues.Columns.Add(tc1)

tc1 = Nothing

PopulatePrdGruppeLev0()
End If
End Sub


The datagrid, dgValues, gets populated in the method
PopulatePrdGruppeLev0().




-as




All times are GMT. The time now is 02:33 PM.

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