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

2.0: two dependent drop down lists

RAM
I need to have two drop down lists in a edited row of a data list. One drop
down list should contain Groups and the second one should contain Materials
from *selected* group.
Thus, I have written:

<asp:SqlDataSource ID="GroupsList" runat="server"
ConnectionString="..." SelectCommand="SELECT ID, Name FROM Groups" />
<asp:SqlDataSource ID="MaterialsList" runat="server"
ConnectionString="..." SelectCommand="SELECT ID, Name FROM Materials WHERE
Group = @Group" >
<SelectParameters>
<asp:FormParameter FormField="ChosenGroup" Name="Group"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:HiddenField ID="ChosenGroup" runat="server" />
<asp:DataList ID="PositionsList" runat="server"
OnEditCommand="..." OnUpdateCommand="..." OnCancelCommand="..."
OnDeleteCommand="..." >
...
<EditItemTemplate>
<tr>
<td>
<asp:DropDownList ID="GroupEdit" runat="server"
DataSourceID="GroupsList" DataTextField="Name"
DataValueField="ID"
OnSelectedIndexChanged="GroupEdit_Changed">
<asp:DropDownList ID="MaterialEdit" runat="server"
DataSourceID="MaterialsList" DataTextField="Name"
DataValueField="Number" />
<td>
...
</asp:DataList>

The problem is that GroupEdit_Changed is not called when I change group in
the drop down list during editing of a PositionsList row. In
GroupEdit_Changed I have written:

protected void GroupEdit(object sender, EventArgs e)
{
ChosenGroup.Value =
((DropDownList)PositionsList.FindControl("GroupEdi t")).SelectedValue;
}

Could you help me please? Thank you!
/RAM/
Oct 9 '06 #1
2 2141
NH
make sure the first dropdown list has autopostback="true" property set.

"RAM" wrote:
I need to have two drop down lists in a edited row of a data list. One drop
down list should contain Groups and the second one should contain Materials
from *selected* group.
Thus, I have written:

<asp:SqlDataSource ID="GroupsList" runat="server"
ConnectionString="..." SelectCommand="SELECT ID, Name FROM Groups" />
<asp:SqlDataSource ID="MaterialsList" runat="server"
ConnectionString="..." SelectCommand="SELECT ID, Name FROM Materials WHERE
Group = @Group" >
<SelectParameters>
<asp:FormParameter FormField="ChosenGroup" Name="Group"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:HiddenField ID="ChosenGroup" runat="server" />
<asp:DataList ID="PositionsList" runat="server"
OnEditCommand="..." OnUpdateCommand="..." OnCancelCommand="..."
OnDeleteCommand="..." >
...
<EditItemTemplate>
<tr>
<td>
<asp:DropDownList ID="GroupEdit" runat="server"
DataSourceID="GroupsList" DataTextField="Name"
DataValueField="ID"
OnSelectedIndexChanged="GroupEdit_Changed">
<asp:DropDownList ID="MaterialEdit" runat="server"
DataSourceID="MaterialsList" DataTextField="Name"
DataValueField="Number" />
<td>
...
</asp:DataList>

The problem is that GroupEdit_Changed is not called when I change group in
the drop down list during editing of a PositionsList row. In
GroupEdit_Changed I have written:

protected void GroupEdit(object sender, EventArgs e)
{
ChosenGroup.Value =
((DropDownList)PositionsList.FindControl("GroupEdi t")).SelectedValue;
}

Could you help me please? Thank you!
/RAM/
Oct 9 '06 #2
I am having a similar to the one listed. I have 2 dropdowns where the
2nd one is dependent on the selection in the first.

What is the basic backend code that is needed for this type of
situation?

Oct 10 '06 #3

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

Similar topics

3
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want...
13
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data...
2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
7
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want...
10
by: lorirobn | last post by:
Hi, I have a form with several combo boxes, continuous form format, with record source a query off an Item Table. The fields are Category, Subcategory, and Color. I am displaying descriptions,...
5
by: ashok893 | last post by:
I'm using two drop down list ina form. I have generated the first drop down list from MySQL database. When i select an option from first drop down list, i have to generate second drop down list...
5
by: rodeoval | last post by:
I need to have three drop down lists, but the dependent should get the values from the database without refreshing the page..If knows,someone pls reply soon
1
by: jdkhan | last post by:
i want to use two lists one dependent on other just like city dependent on country selection how can i do this in single page using PHP
3
by: jcassan | last post by:
Hello folks. I am new to these forums and have something, which has been stumping me for little while. I am using pspell to spellcheck a scrolling textbox (textarea) containing user input. I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
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...

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.