• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 568
  • Last Modified:

Another way of setting focus?

I have a multiview with a next button. I also have a dropdownlist in one of the views. Everytime user clicks on a dropdownlist item, I call the selectedindex changed and reset the focus on the "next" button. I do it like below..

I want to do this in Javascript and not do a postback..anyway to do this?

This is what i have now:

<asp:MultiView runat="server"  ActiveViewIndex="0" ID="mvOutgoingPatient">
 <asp:DropDownList runat="server" TabIndex="16" AutoPostBack="true" OnSelectedIndexChanged="ddlAppoitment_SelectedIndexChanged" CssClass="InputFields" ID="ddlDoctor"></asp:DropDownList>


 <div class="stepNext"  style=" height:55px" >
           <asp:Button ID="btnNext" runat="server" CssClass="next" Text="Next &gt;"  OnClick="btnNext_Click" />	

----------------------- in code behind

 protected void ddlAppoitment_SelectedIndexChanged(object sender, EventArgs e)

Open in new window

1 Solution
Rajar AhmedConsultantCommented:
try this,
        function setbtnFocus() {
            document.getElementById('<%=btnNext.Clientid %>').focus();
<asp:DropDownList runat="server" TabIndex="16"  onchange="setbtnFocus();" CssClass="InputFields" ID="ddlDoctor">

Open in new window


Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now