[RESOLVED] Dropdownlist with both onselectedindexchanged and onchange possible?
Hi everyone,
I have a dropdownlist that looks like this:
<asp:DropDownList
ID="ddlDate"
runat="server"
Height="25px"
Width="200px"
AutoPostBack="true"
OnSelectedIndexChanged="ddlDate_SelectedIndexChanged"
>
</asp:DropDownList>
What I want to be able to do is when the user chooses the date, I want to fire this javascript:
function date_onchange()
{
divstatus.innerHTML = "<font color = red>Please wait...";
}
so that the user sees a "Please Wait ..." message while the data is being gathered. But when I modify the dropdownlist like this:
<asp:DropDownList
ID="ddlDate"
runat="server"
Height="25px"
Width="200px"
AutoPostBack="true"
OnSelectedIndexChanged="ddlDate_SelectedIndexChanged"
onchange="return date_onchange()"
>
</asp:DropDownList>
The "Please Wait..." message appears but the ddlDate_SelectedIndexChanged routine doesn't trigger. Is there a way/better way to do this?
Thanks!
J:)
Re: Dropdownlist with both onselectedindexchanged and onchange possible?
Got it to work: Here's how
<asp:DropDownList
ID="ddlDate"
onchange="date_onchange(); return true"
runat="server"
Height="25px"
Width="200px"
OnSelectedIndexChanged="ddlDate_SelectedIndexChanged"
>
</asp:DropDownList>
function date_onchange()
{
divstatus.innerHTML = "<font color = red>Please wait...";
<%= ClientScript.GetPostBackEventReference(ddlDate, string.Empty) %>;
}
Re: [RESOLVED] Dropdownlist with both onselectedindexchanged and onchange possible?
Hey ediguy,
When you are posting code into the forum, can you remember to surround it in CODE tags (you can find it in the toolbar for entering a post), not only does it make your code easier to read, but it will also stops those smilies appearing all over your code :)
Gary