473,395 Members | 1,885 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,395 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 1525
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.