When the user changes the selection in a DropDownList, the focus remains inside
the dropdown. If the user presses up/down arrow key or moves the mouse wheel,
that action triggers the onchange event on the dropdown.
You can prevent this by making the dropdown lose focus in the onchange event.
JavaScript
function LoseFocus(ddlElem)
{
ddlElem.blur();
}
ASPX
<asp:DropDownList id="ddlLoseFocus" runat="server" AutoPostBack="true"
/>
C#
protected void Page_Load(object sender, EventArgs e)
{
ddlLoseFocus.Attributes.Add("onchange", "LoseFocus(this)");
}
0 comments:
Post a Comment