Answered by:
Dropdownlist Selected Index changed is taking too much time to fire

Question
-
User1914091530 posted
Dropdownlist Selected Index changed is taking too much time to fire for selections after first time.
<asp:DropDownList ID="ddlChannel" runat="server" CssClass="C3_DROPDWNLIST" AutoPostBack="True" OnSelectedIndexChanged="ddlChannel_SelectedIndexChanged">
Thanks
Shijo
Tuesday, March 5, 2019 6:02 AM
Answers
-
User1914091530 posted
The storedprocedure to fetch data to fill dropdown, was calling a userdefind sql function that is taking nearly 30 seconds
issue is identified now...
Regards
Shijo
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, March 5, 2019 10:40 AM
All replies
-
User-893317190 posted
Hi shijostephen,
It is hard to know what problem you have met only according to the code you have provided.
Could you provide your related code to let us reproduce your problem?
Best regards,
Ackerly Xu
Tuesday, March 5, 2019 8:49 AM -
User1914091530 posted
The ddlChannel drop down list has 59 records..
I have placed break point inside the selectedindexchanged event, it takes nearly 30 seconds to hit the breakpoint..
protected void ddlChannel_SelectedIndexChanged(object sender, EventArgs e) { //break point }
Regards,
Shijo
Tuesday, March 5, 2019 9:32 AM -
User-893317190 posted
Hi shijostephen,
I have made a test , even added 70 item into the dropdownlist , still doesn't cost much time.
Below is my code.
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { for (int i = 0; i < 70; i++) { ListItem item = new ListItem(i.ToString()); DropDownList1.Items.Add(item); } } } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { int i = 0; }
<form id="form1" runat="server"> <asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList> </form>
Maybe your page has too much data posted back to server, or you do much operation before OnSelectedIndexChanged.
Could you post your related code?
Best regards,
Ackerly Xu
Tuesday, March 5, 2019 9:58 AM -
User1914091530 posted
There is no code above ddlchannel_selectedindexchanged...Also the page has only 5 dropdownlists with limited(less) no of data...
when i select the 5th record in channel dropdown(59 entries), on second time selection, it is not hitting the selectedindexchanged event at all after waiting for 30 seconds...
I am unable to post the full code, also most of the details i have already provided....
protected void ddlChannel_SelectedIndexChanged(object sender, EventArgs e) { try { if (ddlChannel.SelectedValue != "0") { Populate(); //populates the dropdown with data from database ddlCorporate.Enabled = true; } else { Populate(); //populates the dropdown with data from database ddlCorporate.Enabled = false; } } catch (Exception ex) { //logging } }
Regards,
Shijo
Tuesday, March 5, 2019 10:13 AM -
User1914091530 posted
The storedprocedure to fetch data to fill dropdown, was calling a userdefind sql function that is taking nearly 30 seconds
issue is identified now...
Regards
Shijo
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, March 5, 2019 10:40 AM