First button of page is always getting highlighted

7 posts, 0 answers
  1. Mukesh
    Mukesh avatar
    23 posts
    Member since:
    Aug 2010

    Posted 13 Jan 2011 Link to this post

    I have a popup page which has three buttons on top (with the names "Hide Filter", "Apply Filter" and "Reset")

    Now I want to set focus on second button ("Apply Filter"), but the focus is always goes to first button ("Hide Filter") whenever I click on the page.


    I have also set second button (Apply Filter) as default button :
         <form id="form1" runat="server" defaultbutton="btnERSApplyFilter" defaultfocus="btnERSApplyFilter">

    I have also set focus on page load to second button (Apply Filter):

        btnERSApplyFilter.Focus();

    But both are not working.. please suggest me some solution.


    Thanks
    Mukesh

  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 14 Jan 2011 Link to this post

    Hi Mukesh,

    There was a problem with the RadButton control in the previous version of the RadControls suite for ASP.NET AJAX, so please make sure that you use the latest version of the controls.

    I tested the following project and everything seems to be working OK:
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server" defaultbutton="RadButton2" defaultfocus="RadButton2">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            <telerik:RadButton ID="RadButton1" runat="server" Text="Hide Filter">
            </telerik:RadButton>
            <br />
            <br />
            <telerik:RadButton ID="RadButton2" runat="server" Text="Apply Filter">
            </telerik:RadButton>
            <br />
            <br />
            <telerik:RadButton ID="RadButton3" runat="server" Text="Reset">
            </telerik:RadButton>
            <br />
            <asp:Label ID="Label1" runat="server"></asp:Label>
        </div>
        </form>
    </body>
    </html>

    What you can try is set the UniqueID, or the ClientID of the RadButton to the DefaultButton property in the code behind. If the problem persists please send us a fully working sample project, and we will do our best to help.

    Greetings,
    Pero
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mukesh
    Mukesh avatar
    23 posts
    Member since:
    Aug 2010

    Posted 18 Jan 2011 Link to this post

    Hi Pero,

    I tried with Q3 version ( 210.3.1317.35), but issue was remain same. whenever I click anywhere on the page, the focus goes to first button automatically.
    I also tried with setting default focus to control's UniqueID and ClientID.


    Thanks
    Mukesh
  5. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 20 Jan 2011 Link to this post

    Hi Mukesh,

    Could you please provide a sample project, where we can test the erroneous behavior? You could also send us a live URL where the problem exists.
    What browser do you use to reproduce the issue?

    I tested the code from my previous thread, and still cannot reproduce the issue.

    Kind regards,
    Pero
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. Denis
    Denis avatar
    18 posts
    Member since:
    Feb 2012

    Posted 06 Mar 2012 Link to this post

    Hi I am having a similar issue and I have Q1 2012 NET 40. I have severla buttons on this page and radtextboxes. It is not working.

    thanks in advance

    The rad button is not working as defaultbutton.

      <td align="left" valign="top" >
      <br />
         <telerik:RadButton ID="SearchBtn" runat="server" Text="Search" Skin="Web20" OnClientLoad="OnClientLoad"
               onclick="SearchBtn_Click" Width="160px" Icon-PrimaryIconUrl="~/Content/images/common/btn_search.png">
         </telerik:RadButton><br/><br />
     </td>
    </tr>

    code behind
    protected void Page_Load(object sender, EventArgs e)
            {
              
                this.Form.DefaultButton = SearchBtn.UniqueID;
            
                          .....
  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Mar 2012 Link to this post

    Hello,

    I tried the same in version 2012, 1, 215, 35. I didn't face any such problem. Make sure that you are setting AutoPostBack property of RadTextBox to true. Following is the sample code that i tried.
    ASPX:
    <telerik:RadTextBox ID="RadTextBox1" runat="server" AutoPostBack="true" style="top: -5px; left: 257px; height: 27px; width: 294px;">
    </telerik:RadTextBox>
    <telerik:RadButton ID="SearchBtn" runat="server" Text="Search" Skin="Web20" OnClientLoad="OnClientLoad" onclick="SearchBtn_Click" Width="160px" Icon-PrimaryIconUrl="~/Images/edit.jpg">
    </telerik:RadButton>
    C#:
    protected void Page_Load(object sender, EventArgs e)
     {
      this.form1.DefaultButton = SearchBtn.ClientID;
     }

    Thanks,
    Princy.
  8. Denis
    Denis avatar
    18 posts
    Member since:
    Feb 2012

    Posted 07 Mar 2012 Link to this post

    Thanks I was missing the AutoPostBack to True
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017