binding template items together

B

bmayer

I am using a detail view and binding it to a sql data source (at some
point in the future it will be an object data source).

I have seen the article "Working with Data is ASP.NET 2.0 ::
Customizing the Data Modification Interface", and its description of
how to turn one of the fields into a template field, then add a drop
down list. I want to do the same thing except I want two drop down
lists, with the second one populating its values from a sql query that
takes a parameter from the first drop down list.

The problem that I am having is that it appears that the first drop
down list is out of the scope of the second drop down list.

Any ideas on how to bind the two together?

Ben
 
C

Cowboy \(Gregory A. Beamer\)

Where are you binding things? Page_Load? Init?

The most common reason there are problems with binding is either a)
reloading in Page_Load with every hit or b) grabbing before controls are
rebound from ViewState. The best way to handle your app is draw it out from
request to page drawn for both flows and marry in one document. You can then
code through and have it bound properly. When you try to finish one and bolt
on the other is when you get things out of order and get stuck.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside the box!
*************************************************
 
B

bmayer

All of the binding I have done is through the Visual Web Developer UI.
I dragged a DetailsView onto a new .aspx page and set its default mode
to insert. Bound it to a SqlDataSource and got it to auto-populate the
fields. I then converted the MedID and Formulation fields to template
fields. I them modified the MedID field to have a DropDownList and
bound that to a SqlDataSource. The SQL for this is:

SELECT [MedId], [BrandName] FROM [lut_MedSeizure] WHERE ([ynAllowRx] =
1)

So I display the BrandName and use the MedId as a Foreign Key. That
part works fine.

I then went to the edit the InsertItemTemplate for the Formulation
field. Here I again inserted a DropDownList and a SqlDataSource. The
sql to populate this particular ddl is

SELECT FormulationNo, Formulation FROM lut_Formulation WHERE (MedId =
@MedId)

What I want to do is pull the @MedId from the selected item in the
first DropDownList. The problem is when I use the "Configure Data
Source" wizard for the Formulation field and I am selecting a
parameter source it does not give me the option to use DropDownList1,
with is in the other template field.

Any suggestions for this?

Thank you for the reply,
 

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,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top