Programatically add column

A

Audun Simonsen

Hi.

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

Anybody with some pointers?


-as
 
A

Audun Simonsen

Saravana said:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top