Dynamically added dock with dynamically added controls and validation

4 posts, 0 answers
  1. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 18 Feb 2009 Link to this post


    I have a small problem working with dock.

    I have a dock layout and I am adding docks dynamically like on the demo website.
    I also load the dock content dynamically (like on the demo website again).
    The problem is that the control has several textboxes with validators.

    When I press the button it does postback, but has CausesValidation set to true.

    The validation works when I statically load the control.
    All controls have unique id's, loaded on Init to preserve postbacks etc.

    How to solve this ?
  2. Obi-Wan Kenobi
    Obi-Wan Kenobi  avatar
    460 posts
    Member since:
    Aug 2007

    Posted 23 Feb 2009 Link to this post

    I created an usercontrol, add it to the example and everything seems to be OK.
    <asp:UpdatePanel runat="server" ID="UpdatePanelUserControl">  
            <asp:TextBox ID="TextBox1" runat="server">  
            <asp:RequiredFieldValidator ID="RequiredField1" runat="server" ControlToValidate="TextBox1" 
            <asp:Button ID="btnChangeTime" runat="server" Text="ChangeTime" CausesValidation="true"/>  
     protected void Page_Load(object sender, EventArgs e)  
            TextBox1.Text = System.DateTime.Now.ToString();  
  3. Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 23 Feb 2009 Link to this post

    Wrong :S

    You need to :

    1. Prepare the page for dynamic dock creation (save layout, load layout, restore state to dynamic docks)
    2. in page_load !ispostback create a dock dynamically and do Page.LoadControl(usercontrol). Add control to the dock.

    Then the buttons on the page will do postback instead of being blocked by the validators
  4. Petio Petkov
    Petio Petkov avatar
    825 posts

    Posted 24 Feb 2009 Link to this post

    Hi Roland,

    Please open a new support ticket and send us running project where we can observe the problem. Once we receive it, we will do our best to help you.

    All the best,
    Petio Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top