Another way of setting focus?

Posted on 2012-08-30
Last Modified: 2012-08-30
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

Question by:Camillia
    1 Comment
    LVL 18

    Accepted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now