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

Dynamically added dock with dynamically added controls and validation

3 Answers 76 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 18 Feb 2009, 04:18 PM
Hello,

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 ?

3 Answers, 1 is accepted

Sort by
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 23 Feb 2009, 12:41 PM
I created an usercontrol, add it to the example and everything seems to be OK.
ASCX:
<asp:UpdatePanel runat="server" ID="UpdatePanelUserControl">  
    <ContentTemplate> 
        <asp:TextBox ID="TextBox1" runat="server">  
        </asp:TextBox> 
        <asp:RequiredFieldValidator ID="RequiredField1" runat="server" ControlToValidate="TextBox1" 
            Text="pleaseAddText">  
        </asp:RequiredFieldValidator> 
        <asp:Button ID="btnChangeTime" runat="server" Text="ChangeTime" CausesValidation="true"/>  
    </ContentTemplate> 
</asp:UpdatePanel> 
Codebehind:
 protected void Page_Load(object sender, EventArgs e)  
    {  
        TextBox1.Text = System.DateTime.Now.ToString();  
    } 
0
Roland
Top achievements
Rank 1
answered on 23 Feb 2009, 02:46 PM
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
0
Petio Petkov
Telerik team
answered on 24 Feb 2009, 07:10 AM
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.
Tags
Dock
Asked by
Roland
Top achievements
Rank 1
Answers by
Obi-Wan Kenobi
Top achievements
Rank 1
Roland
Top achievements
Rank 1
Petio Petkov
Telerik team
Share this question
or