Multiple DataSouce for a DataGrid

G

Guest

How to bind Multiple results into a datagrid.

For example Assume the values for dsCustCode.Tables(0).Rows.Count = 4,and
the values are "'Val1','val2','val3','val4'" in the below loop

In the above situation four datasource needs to be bind in the grid. I know
the below is binding the last value's (Val4) datasource in the DataGrid

For iCountCustCode = 0 To dsCustCode.Tables(0).Rows.Count - 1
CusCode =
dsCustCode.Tables(0).Rows(iCountCustCode)("CustCode").ToString ' say the
values are 'Val1','val2','val3','val4'
DataGrid1.DataSource = _Dac.GetOrders(CusCode, ControlNum,
AppLast, AppFirst, AppSocial, CaseNum) 'assume ControlNum, AppLast, AppFirst,
AppSocial, CaseNum are null
DataGrid1.DataKeyField = "RECORD_NUMBER"
DataGrid1.DataBind()
Next

if http://www.codeproject.com/aspnet/DataGridMultipleResultset.asp helps,
then let me know how to modify the sample code according to my requirement.
 
G

Guest

Actually, your code is binding every one in the loop, you only get to see
that last one because that's the last one before the loop ends.

if you have set your datagrid up correctly, you do NOT NEED A LOOP.

Just assign the datasource to the grid, and call it's DataBind method one
time.
Peter
 

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,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top