473,625 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2602
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****@mnepile psy.net" <bm****@gmail.c omwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.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 InsertItemTempl ate 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****@mnepile psy.net" <bm****@gmail.c omwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.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
3086
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 icollection...but i thought list boxes did implement one of the above as they do have their items collection property, can anyone help?
4
1738
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 gets a subset by selecting from the first list box) and i have a datagrid which has a template column and a bound column, i want to bind the bound column to this second listbox and then its template column implements a dropdownlist for every bound...
5
8617
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
1340
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=="",' ',"hi"+au_lname) Is it possible to do so?
1
1408
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 the grid population event and the other is to populate the dropdownlist I'll start with the method that binds the dropdownlist. As mentioned it is object based and also works fine everywhere but in a template column. I have put in some comments...
3
2047
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 not declared". The data bind is for a DataList.)
0
2067
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 record for when the user selects an entry in the combo. This is my generic class: public class ComboItems {
4
4905
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; //open connection SqlConnection m_conn = new SqlConnection("Server=server; Database=database; UId=username; Pwd=password");
1
2424
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 projects to minimize required changes initially. I am stuck on a problem using a data grid. I have a usercontrol that has a DataGrid on it. The datagrid has an item template that loads another common user control for every row. I am getting
0
8688
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8352
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7178
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6115
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.