getting data binding parameters from another WebControl

A

aarnan

I have two SqlDataSources that use two different stored procedures that
take parameters to populate two controls, one dependant on an element
of the other.

The first data source, PreBuyDataSource is bound to PreBuyDetailsView
control and its parameters come from the session or request. The
stored procedure will always only find one row, and I found the
DetailsView control to be convenient.

The second data source, BudgetDataSource is bound to BudgetDetailsView
control and one of the parameters is an element in the data present in
the PreBuyDetailsView. Likewise, the stroed procedure will always only
find one row, and I found the DetailsView control to be convenient.

Specifically, the element that BudgetDataSource depends on is

PreBuyDetailsView.DataItem.Item("PRBCODE")

....or in English, the column named PRBCODE (column index 3) that gets
returned from the stored procedure.

When I click on the SelectQuery to bring up the dialog for
BudgetDataSource's stored procedure, I have my parameters, one of which
needs to come from PRBCODE. I set my Parameter Source to "control." I
set my control ID to PreBuyDetailsView. Under the advanced properties,
the property name defaults to SelectedValue, which appears blank to me.
I tried to set it to DataItem.Item("PRBCODE"), but when I do that I
get an error: 'System.Data.DataRowView' does not contain a property
with the name 'Item'.

System.Data.DataRowView DOES contain a public property named Item since
I can access it directly for instance by setting a labels text value to
PreBuyDetailsView.DataItem.Item("PRBCODE"). However, my grasp of when
and where the databinding takes place for multiple controls is
admittedly weak.

I cannot figure out how to get the data binding on my BudgetDetailsView
to use that value from PreBuyDetailsView. I am new to ASP.NET and hope
I am either going about this in entirely the wrong way, or missing some
key bit of insight. Either way, can anyone tell me how I can set that
value as a parameter for my second data source?
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top