DataList - Capture the SelectedIndexChanged of a dropdownlist within template

T

Todd Fisher

I need help please...
I am try to capture the selectedindexchanged on a dropdownlist in a
datalist template.

I want to update another dropdown in the template based off of my
first dropdown choice selection.

I assume you would set the selectedindex change of the dropdown field
on the itemdatabound of the template but... I haven't figured it out
yet.

Any help is appreciated.
Thank you.
 
H

Hermit Dave

Never tried doing something like this but will help you brainstorm a bit

try autopostback=true for the DDL
now on SelectIndexChanged event handler
try and get the value
next try and get hold of the parent ie the datagrid item the DDL belongs to
once you have that
grab hold of the required DDL (the second one) using item.FindControl
and try and set its selected index to whatever you fancy

you reckon that would work ?

HTH

HD
 
Joined
Jul 19, 2007
Messages
1
Reaction score
0
Hai
I read ur code. And i have written the code like

HTML
------
<EditItemTemplate>
<asp:DropDownList ID="Dropdownlist1" Runat="server" AutoPostBack="True" OnSelectedIndexChanged="Dropdownlist1_SelectedIndexChanged"></asp:DropDownList>
</EditItemTemplate>
CodeBehind
-----------
public void Dropdownlist1_SelectedIndexChanged(object sender,EventArgs e)
{
-----
}


But i am getting autopost back for the dropdown list but there no action is taking place.
I would be very greatful to u if u help me.

Thank u
 

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,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top