473,396 Members | 1,766 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,396 software developers and data experts.

binding template items together

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

Aug 16 '06 #1
2 2584
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!
*************************************************
"bm****@mnepilepsy.net" <bm****@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
>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

Aug 16 '06 #2
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,

Ben
Cowboy (Gregory A. Beamer) wrote:
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!
*************************************************
"bm****@mnepilepsy.net" <bm****@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
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
Aug 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: ShadowsOfTheBeast | last post by:
hi all i am trying to bind data to my datagrid from a listbox which i think it should work but an error is coming up saying i have to bind to a datasource that implements the Inumerable or...
4
by: ShadowsOfTheBeast | last post by:
hi oliver thanks for your help i kinda figured that out minutes afterwards...but what i am actually trying to do is this: i have a listbox control that gets its data from another listbox (hence...
5
by: peter_k | last post by:
Hi I've defined hash_map in my code using this: ------------------------------------------- #include <string> #include <hash_map.h> & namespace __gnu_cxx {
1
by: reiks | last post by:
Do we any computed column for the datagrid? Do we any expression property for the datagrid columns? My requirement is I ought to bind the following expression at design time if(au_lname=="",'...
1
by: Harold | last post by:
Hi all, having a little difficulty binding up a dropdownlist control in a datagrid column. I know I must be missing something Here are 2 methods. One is the DataGrid's ItemDataBound event to catch...
3
by: bbernieb | last post by:
Hi, All, Is it possible to access a variable inside of a data binding, without the variable being out of scope? (Note: On the DataBinder line, I get an error message that says "Name 'i' is...
0
by: Siv | last post by:
Hi, I have a class that I want to use generically to add items to a combobox so that I have a display item and an ID item that isn't displayed but that I can use to display the relevant database...
4
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
1
by: Stephen Barrett | last post by:
I have an application that was originally built with ASP.Net 1.1. We finally got permission to migrate to 2.0. Due to time constraints we migrated the web projects to 2.0 web application...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.