Click here to Skip to main content
14,927,639 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i m using asp.net,C#,VS 2005,sql server 2005..

i have a aspx page...
when Page_Load(object sender, EventArgs e) occurs iam loading dropdownlist with some text values such as study1,study2.... from database...

but when i click on these items SelectedIndexChanged(object sender, EventArgs e) of dropdownlist does not firing...

any help plz...

regards
karan
Posted

1 solution

set autopost back property of dropdown = True

like Below

<asp:DropDownList ID="Dropdown1" runat="server" AutoPostBack="true">
   
v3
Comments
karan joshua 12-May-11 3:23am
   
thank u sir... It works

one more question:

when i SelectedIndexChanged occurs whatever items there in dropdownlist is added again to DDL..

i.e. if initially 4 items were there on 1 event 8 items will be added then one more event 12 etc

wht s the problem..?

regards
karan
Mahendra.p25 12-May-11 3:27am
   
Post your code
karan joshua 12-May-11 3:30am
   
<asp:DropDownList ID="StudyIDTextBoxDropDownList" runat="server" Font-Bold="True" AutoPostBack="true"
Font-Size="Large" ForeColor="Black" Height="23px"
Width="198px" OnSelectedIndexChanged="StudyIDTextBoxDropDownList_SelectedIndexChanged" >
<asp:ListItem Value="-1" Selected="True">Select

Mahendra.p25 12-May-11 3:31am
   
Code behind code
Mahendra.p25 12-May-11 3:32am
   
protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
{
BindDropdown

}
}
karan joshua 12-May-11 3:36am
   
It is also working sir... thank u very much...
karan joshua 12-May-11 3:34am
   
k sir it works now..

i have added:

StudyIDTextBoxDropDownList.Items.Clear();

when the page_load occurs

thank u sir....
Mahendra.p25 12-May-11 3:42am
   
WC

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



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