Default focus cannot be set to a button inside RadDock

3 posts, 1 answers
  1. TSM
    TSM avatar
    38 posts
    Member since:
    Jun 2010

    Posted 24 Feb 2011 Link to this post

    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. Answer
    Pero
    Admin
    Pero avatar
    1156 posts

    Posted 24 Feb 2011 Link to this post

    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!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. TSM
    TSM avatar
    38 posts
    Member since:
    Jun 2010

    Posted 25 Feb 2011 Link to this post

    Hi ,
           Thanks for your kind reply.It works.
    Regards Titti.S
Back to Top