Dynamically added User Control utilizing RadInputManager Validation locks up Postback

2 posts, 0 answers
  1. Johnathan
    Johnathan avatar
    5 posts
    Member since:
    Mar 2012

    Posted 04 Mar 2012 Link to this post

    I have a wizard, Regular ASP.NET for a custom sign up process as the Membership version did not fit the bill. One of the last steps includes a process to register several contacts to associate with the primary account. I wrote a User Control with basic fields for gather Name, Address, City and regular drop down for the State which utilizes a RequiredFieldValidator. This user control utilizes the RadInputManager for controlling the validation.

    Here is the User Control markup:
    <asp:Panel ID="pnlClient" runat="server">
        <asp:TextBox ID="tbClientName" runat="server"></asp:TextBox>
        <span class="width500">
            <asp:TextBox ID="tbAddress1" runat="server"></asp:TextBox>
        </span>
        <br />
        <span class="width250">
            <asp:TextBox ID="tbAddress2" runat="server"></asp:TextBox>
        </span>
        <br />
        <span class="width250">
            <asp:TextBox ID="tbCity" runat="server"></asp:TextBox>
        </span>
        <br />
        <asp:DropDownList ID="ddlState" runat="server" DataSourceID="EntityDS_StateProvince"
            DataTextField="Name" DataValueField="Id" AppendDataBoundItems="true">
            <asp:ListItem Text="[Resident State]" Value="ZZ"></asp:ListItem>
        </asp:DropDownList>
        <asp:RequiredFieldValidator ID="rfvStateProvince" runat="server" EnableViewState="true" EnableClientScript="true"
            ControlToValidate="ddlState" Display="Static"
            Enabled="true" ErrorMessage="Valid State is required." InitialValue="ZZ" />
        <br />
        <span class="width125">
            <asp:TextBox ID="tbZip" runat="server"></asp:TextBox>
        </span><span class="width300">
            <asp:TextBox ID="tbLetterName" runat="server"></asp:TextBox>
        </span>
        <br />
        <span class="width500">
            <asp:TextBox ID="tbEmail" runat="server">
            </asp:TextBox></span>
        <telerik:RadInputManager ID="rimClient" runat="server">
            <telerik:TextBoxSetting BehaviorID="tbbClientName" EmptyMessage="Name" ErrorMessage="Name required."
                Validation-IsRequired="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="tbClientName" />
                </TargetControls>
            </telerik:TextBoxSetting>
            <telerik:TextBoxSetting BehaviorID="tbbAddress1" EmptyMessage="Address 1" ErrorMessage="Address is required."
                Validation-IsRequired="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="tbAddress1" />
                </TargetControls>
            </telerik:TextBoxSetting>
            <telerik:TextBoxSetting BehaviorID="tbbAddress2" EmptyMessage="Address 2" Validation-IsRequired="false">
                <TargetControls>
                    <telerik:TargetInput ControlID="tbAddress2" />
                </TargetControls>
            </telerik:TextBoxSetting>
            <telerik:TextBoxSetting BehaviorID="tbbCity" EmptyMessage="City" ErrorMessage="City is required"
                Validation-IsRequired="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="tbCity" />
                </TargetControls>
            </telerik:TextBoxSetting>
            <telerik:TextBoxSetting BehaviorID="tbbZip" EmptyMessage="Zip" ErrorMessage="Zip is required"
                Validation-IsRequired="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="tbZip" />
                </TargetControls>
            </telerik:TextBoxSetting>
            <telerik:TextBoxSetting BehaviorID="tbbContactName" EmptyMessage="Contact Client"
                ErrorMessage="Contact Client required" Validation-IsRequired="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="tbLetterName" />
                </TargetControls>
            </telerik:TextBoxSetting>
            <telerik:RegExpTextBoxSetting BehaviorID="tbbEmail" EmptyMessage="Email" ValidationExpression="^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"
                ErrorMessage="Invalid Email" Validation-IsRequired="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="tbEmail" />
                </TargetControls>
            </telerik:RegExpTextBoxSetting>
        </telerik:RadInputManager>
        <asp:EntityDataSource ID="EntityDS_State" runat="server" ConnectionString="name=LUEntities"
            DefaultContainerName="LUEntities" EnableFlattening="False" EntitySetName="StateProvinces"
            Where="s.ID != 'ZZ'">
        </asp:EntityDataSource>
    </asp:Panel>


    Step 1 of the wizard uses this control and works fine since only 1 instance of the user control is used. Validation occurs as it should.
    Step 2 has an optional step to gather up a contact's beneficiary information. It is optional in the sense that some users choose to set it up later or can choose from a list of supplied Trust Attorneys. if they opt in then I enabled the User control and its subsequent validations. This works fine too.
    Step 3 has an optional step to gather secondary beneficiaries information. This is where I am scratching my head. (See Markup)

    Somewhere along the line one (or more) of these is failing/doing something unintentional. During Page Load I disable all of the radpanelitems featuring this User Control (ClientUC). I also parse the controls and disabled the RadInputManager as well as the RequiredFieldValidator within them.
    <asp:WizardStep ID="Step_SecondBen" StepType="Step" Title="Secondary Beneficiaries">
        <telerik:RadAjaxPanel ID="rapBeneficiaries" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
            <telerik:RadButton ID="AddBen" runat="server" Text="Add" OnClick="AddBen_Click" AutoPostBack="true"
                CausesValidation="false">
            </telerik:RadButton>
            <telerik:RadPanelBar runat="server" ID="rpbBenList" ExpandMode="FullExpandedItem"
                OnItemClick="rpbBenList_ItemClick" Width="100%" Height="300px" CausesValidation="false">
                <Items>
                    <telerik:RadPanelItem Text="Beneficiary 1" Expanded="true">
                        <Items>
                            <telerik:RadPanelItem>
                                <ItemTemplate>
                                    <uc1:clientuc id="Beneficiary1" runat="server" />
                                </ItemTemplate>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelItem>
                    <telerik:RadPanelItem Text="Beneficiary 2">
                        <Items>
                            <telerik:RadPanelItem>
                                <ItemTemplate>
                                    <uc1:clientuc id="Beneficiary2" runat="server" />
                                </ItemTemplate>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelItem>
                    <telerik:RadPanelItem Text="Beneficiary 3">
                        <Items>
                            <telerik:RadPanelItem>
                                <ItemTemplate>
                                    <uc1:clientuc id="Beneficiary3" runat="server" />
                                </ItemTemplate>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelItem>
                    <telerik:RadPanelItem Text="Beneficiary 4">
                        <Items>
                            <telerik:RadPanelItem>
                                <ItemTemplate>
                                    <uc1:clientuc id="Beneficiary4" runat="server" />
                                </ItemTemplate>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelItem>
                    <telerik:RadPanelItem Text="Beneficiary 4">
                        <Items>
                            <telerik:RadPanelItem>
                                <ItemTemplate>
                                    <uc1:clientuc id="Beneficiary4" runat="server" />
                                </ItemTemplate>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelBar>
        </telerik:RadAjaxPanel>
    </asp:WizardStep>

    The Result I get is that I am unable to navigate forward even if i add (basically enable the user control) 0 beneficiaries. The Next button does not postback. I have added to the user control client side "OnError" functions to the RadInputManager however all 5 RIMs never hit the event (not sure why). I need a method that will tell me which validator is locking up the postback and how to properly address it. I can however postback using the previous button.

    What am I missing?
  2. Johnathan
    Johnathan avatar
    5 posts
    Member since:
    Mar 2012

    Posted 04 Mar 2012 Link to this post

    Disregard, viewstate is needed for RadInputManager. Problem solved.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top