473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Dynamically binding a Datagrid

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
Jul 21 '05 #1
1 1526
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).
"Deepa" <De***@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
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

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bewley Andrew, Sale | last post by:
Hi, I have a dataset table whose column definition is dynamic. (I.e. the viewable columns are configured by the user). Within the table one or more columns need to be displayed as a...
0
by: Ann Morris | last post by:
INTRODUCTION One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a...
2
by: Tim_Mac | last post by:
hi, i have an aspx page which dynamically loads a user control and adds it to a placeholder. the control is recreated and added to the placeholder for postbacks as well. the user control...
3
by: david | last post by:
I have posted my question before. It seems that I can not find the solution. The question: I have datasource, say, ds which is bounded to a datagrid, dg. Assume that ds have 5 columns,...
5
by: Brad Shook | last post by:
I am trying to bind one column of a datagrid to a seperate textbox and the rest of the fields to a datagrid. the comments are too large to fit in a datagrid so I created a textbox below the...
7
by: pmclinn | last post by:
I was wondering if it is possible to dynamically create a structure. Something like this: public sub main sql = "Select Col1, Col2 from Table a" dim al as new arraylist al =...
1
by: Deepa | last post by:
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...
0
by: Silver Oak | last post by:
I have a DataGrid in which one of the columns is TemplateColumn that was created dynamically using iTemplate. I would like to have multi-row editing capability on the DataGrid. I'm trying to...
4
by: Craig Buchanan | last post by:
I dynamically add data-bound templates to a gridview in my ascx control. while this works correctly when the gridview is databound to the datatable, i'm having issues on postback. i would like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.