Dynamically binding a Datagrid

G

Guest

I am doing an ASP.Net application wherein I have a datagrid which I need to
populate dynamically. The grid has 5 rows and two columns. In the 2nd col I
need to insert dropdown boxes. I'll have to populate both the cols from the
database. The values for the 2 cols come from 2 diff tables. How do I do this?

Also in the design mode, do I have to manually mention the Collections
property of the datagrid columns as Template Columns?

This is urgent. I'd appreciate if someone can help me.

Thanks
 
J

JV

Probably the easiest way is to use a Connection object, a Data Adapter (one
for each table, in your case) and a DataSet. If you create a connection in
the server explorer (look on the left) you can drag a table from in there
onto your form and it will create the first two for you. Beyond that,
please reference the online help for binding a DataGrid to DataSet and it
should become pretty clear.

As far as the dropdown boxes, you are correct, you will want to make that a
template column.

In addition to http://msdn.microsoft.com I find that there's a lot of
helpful examples on some other web sites like http://www.codeproject.com
(free to sign up).
 

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

Top