Datagrid binding inconsistencies...............

G

Guest

In a web application we have a page that has two data grids (dg1 & dg2), 2
dataadpaters (da1 & da2), and 2 datasets (ds1 & ds2). The dataadpaters and
datasets were created by dragging and dropping the objects from the data
toolbar.

dg1 is bound to ds1 through da1
dg2 is bound to ds2 through da2

When operating properly the page should work as follows the two grids show
the data correctly. However, sporadically, both datasets appear in dg2.
Confusing?

Has anyone ever seen anything like this?
 
G

Guest

There is no reason for this to happen except that you might have accidently
mixed up the dataadapters' binding. If you post the code that you use, one
might be able to help.
 
G

Guest

OK, here is the code:

Try

prmFYCd.Value = Me.dlstFiscalYear.SelectedValue
prmOwnerCd.Value = Session("strSessionUserId")

prmLevelCd.Value = Me.rlstTaskLevel.SelectedValue

' Populate the budgeted data adapter and bind it to the datagrid.
' DataAdapter1 has data source spGetBudgetedSPs.
'spGetBudgetedSPs need FY and Owner.

SqlDataAdapter1.SelectCommand.Connection = conCnn
SqlDataAdapter1.SelectCommand.Parameters.Add(prmFYCd)
SqlDataAdapter1.SelectCommand.Parameters.Add(prmOwnerCd)

SqlDataAdapter1.SelectCommand().CommandTimeout =
cnstCommandTimeout
SqlDataAdapter1.Fill(GetBudgeted2)
DataBind()

' Clear parameters.

SqlDataAdapter1.SelectCommand.Parameters.Clear()

' DataAdapter2 has data source spGetNonBudgetedSPs.
'spGetNonBudgetedSPs need FY and TaskLevel.

SqlDataAdapter2.SelectCommand.Connection = conCnn
SqlDataAdapter2.SelectCommand.Parameters.Add(prmFYCd)
SqlDataAdapter2.SelectCommand.Parameters.Add(prmLevelCd)
SqlDataAdapter2.SelectCommand.Parameters.Add(prmOwnerCd)

SqlDataAdapter2.SelectCommand().CommandTimeout =
cnstCommandTimeout
SqlDataAdapter2.Fill(GetNonBudgeted2)
DataBind()
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top