Click here to Skip to main content
16,004,924 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear,

I am in trouble controlling two drop-down control,
Problem:

when,first drop-down control select,then 2nd drop-down control select(it has event),then first control reload,I have checked several way to find out the problem,I can not find any difficulties that will reload first drop-down

 if (!IsPostBack)
        {
           first & 2nd control load this way
        }


if anyone have previous experience to solve this issue,please help me.
N.B.: first control rad dropdown & 2nd control normal asp.net drop-down.Page has Update Panel & Rad ajax Panel.

Thanks in
Posted
Updated 15-Sep-13 0:35am
v2

Hi!.

i think you need updatepanel for this

first you need AJAX extensions VS2010 has this toolbox


first thing to do drag and drop script manager to you page or to your master page
so ajax script can be used
*note
script manager need just for one page
but if you have masterpage you can put it there so you would not put it again.

then drag and drop update panel to your page
then after that under update panel put ContentTemplate
then put your dropdownlist inside contenttemplate

the code will look like this

XML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:DropDownList ID="DDL1st" runat="server">
            </asp:DropDownList>
             <asp:DropDownList ID="DDL2nd" runat="server"  AutoPostBack="True">
            </asp:DropDownList>
        </ContentTemplate>



Look at 2nd DDL the autopostback=true so that any event that fired by 2nd dll will be executed

remember all of this is inside the updatepanel so all post back will be handle without refreshing your page.

i hope this is the answer to your question
 
Share this answer
 
v2
Well keep it simple you will find an answer
first dropdown
HTML
<drop....  önchange="dropdownchangeevent">
<listitem value="1">1</listitem>
<listitem value="2">2</listitem>
</drop....>

second one
XML
<drop....>
<listitem value='1'>1</listitem>
<listitem value='2'>2</listitem>
</drop>

now in c#
C#
protected void dropdownchangeevent(object sender, EventArgs e)
    {


//here from frist dropdown seleted values bind second dropdown

now add dropdown1.selecedvalue=whatever you want to select 

}


regards..:)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900