I have three dropdown list on my page for country,
state, city, area and society. All these 5 dropdown list are in update panel so
that I can use partial rendering features of AJAX. Its working fine. All 5 dropdown
list are working great and I was feeling proud that I implemented it.
But fuck to my tester who find out issue related with
these dropdown list as well. Whenever he select state, my tab order is changed
and instead of state itself, my default focus set to next control after
society. However
in any situation it should focus on current dropdown list.
I tried to solve it though javascript and JQuery but none
of them work.
To solve this just write below code in current postback
event as
protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlList = (DropDownList)sender;
ScriptManager.GetCurrent(Page).SetFocus(ddlList);
}
Please leave your comments or share this code if it’s
useful for you.
No comments:
Post a Comment