Building a datagrid in code

T

Tina

I'm developing an asp.net ascx control that will allow editing of any
database table. After getting table names and columns from
INFORMATION_SCHEMA I have to build a datagrid in code consisting of template
columns with a textbox in each ItemTemplate.

For each column I build the following code works fine....

dim myCol as new TemplateColumn
myCol.headertext = row("COLUMN_NAME")
dim myTB as new Textbox
myTB.ID = row("COLUMN_NAME")

So, now I have a TemplateColumn and a textbox but I can't figure out how to
put the textbox into the template column before I do dg.columns.add(myCol)

I've tried various assignments and casts with no success thus far.

Anyone know how to do this? Anyone know of a knowledge base that addresses
building grids in code and assigning the various attribute values - all the
same things we do with property builder.

Thanks,
T
 
T

Tina

srini,
This is what I am looking for! However I'm having a little trouble cooping
with your C# as I am a vb developer. What does:
txtTemp.databinding += new System.EventHandler(BindTextBox)
do?

I think it is raising an event but my C# to vb translator can't handle it.
Thanks,
T
 
G

Guest

hi Tina,
This line translates to
AddHandler txtTemp.databinding , AddressOf BindTextBox in vb.net. I am
adding a event handler to the txtTemp textbox here.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top