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

Default focus cannot be set to a button inside RadDock

2 Answers 74 Views
Dock
This is a migrated thread and some comments may be shown as answers.
TSM
Top achievements
Rank 1
TSM asked on 24 Feb 2011, 12:47 PM
Hi All,
          Im using my Login Button inside the RadDock and i can't set the defaultbutton property of my page's form tag.Also i cant get my controls in script which is inside RadDock.I solved it by getting the clientID of btLogin .

  (ie):document.getElementById("<%=btLogin.ClientID %>")

and same problem might have been occured with defaultbutton .Here is my design.

 <form id="form1" runat="server" defaultbutton="btLogin">
<div>
<telerik:RadDockZone ID="rdzLogin" runat="server" Width="100%" Height="350px">
         <telerik:RadDock ID="rdLogin" Title="<b>Login</b>" runat="server" EnableAnimation="true"
             DefaultCommands="None" EnableDrag="false" Skin="Default" EnableRoundedCorners="true">
              <ContentTemplate>
                   <asp:Button ID="btLogin" runat="server" Login" OnClick="btLogin_Click" />
             </ContentTemplate>
        </telerik:RadDock>
    </telerik:RadDockZone> 
       </div>
</form>

I get the following error while setting defaultbutton in form tag itself and when i remove it no problem occurs :

The DefaultButton of 'form1' must be the ID of a control of type IButtonControl.

Can i set defaultbutton from code behind? Please Help me out...

Regards and Thanks,
    Titti.S

2 Answers, 1 is accepted

Sort by
0
Accepted
Pero
Telerik team
answered on 24 Feb 2011, 03:51 PM
Hi Titti,

The RadDock is an INamingContainer, which means that the form of the page and the button control in the dock will not be in the same INamingContainer, and the form cannot find the button set as DefaultButton. That's why you should pass the UniqueID of the button the the DefaultButton property, in the code behind, i.e.:

protected void Page_Load(object sender, EventArgs e)
{
    form1.DefaultButton = btLogin.UniqueID;
}

Greetings,
Pero
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
TSM
Top achievements
Rank 1
answered on 25 Feb 2011, 02:46 PM
Hi ,
       Thanks for your kind reply.It works.
Regards Titti.S
Tags
Dock
Asked by
TSM
Top achievements
Rank 1
Answers by
Pero
Telerik team
TSM
Top achievements
Rank 1
Share this question
or