This is a migrated thread and some comments may be shown as answers.

First button of page is always getting highlighted

6 Answers 327 Views
Button
This is a migrated thread and some comments may be shown as answers.
Mukesh
Top achievements
Rank 1
Mukesh asked on 13 Jan 2011, 11:23 AM
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

6 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 14 Jan 2011, 01:54 PM
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.
0
Mukesh
Top achievements
Rank 1
answered on 18 Jan 2011, 01:12 PM
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
0
Pero
Telerik team
answered on 20 Jan 2011, 12:51 PM
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.
0
Denis
Top achievements
Rank 2
answered on 07 Mar 2012, 12:12 AM
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;
        
                      .....
0
Princy
Top achievements
Rank 2
answered on 07 Mar 2012, 06:36 AM
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.
0
Denis
Top achievements
Rank 2
answered on 07 Mar 2012, 03:06 PM
Thanks I was missing the AutoPostBack to True
Tags
Button
Asked by
Mukesh
Top achievements
Rank 1
Answers by
Pero
Telerik team
Mukesh
Top achievements
Rank 1
Denis
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or