Various RadComboBox implementations with Required Field Validation

Thread is closed for posting
5 posts, 0 answers
  1. EF2E2150-BEB5-4BA9-AAFE-3FAC7A7B7F5E
    EF2E2150-BEB5-4BA9-AAFE-3FAC7A7B7F5E avatar
    4 posts
    Member since:
    Apr 2008

    Posted 25 Mar 2009 Link to this post

    Requirements

    RadControls version

     Q1 2009

    .NET version

    3.5    

    Visual Studio version

    2008

    programming language

    C#,Javascript

    browser support

    Tested On IE 7.0.5730 


    PROJECT DESCRIPTION 
    This project shows how to use
    1. Standard CheckBoxes along with RadComboBox templates to select multiple RadComboBox items with required field validation.
    2. AllowCustomText property applied RadComboBox with required field validation
    3. LoadOnDemand property applied RadComboBox with required field validation.

    Briefly, I create a web page with 3 different radcombobox requirements.

    1. Multiple Selection RadComboBox
      • Because of validation, text field is set to empty when user enters custom text and not checked any item or user enters another character after select any item.
      • So it always passes the validation correctly.
    2. AllowCustomText property applied RadComboBox
      • Validation gives error when user try to enter a text that is not in the list.
      • Text is set to empty with OnClientBlurHandler when user try to enter a text that is not in the list.
    3. LoadOnDemand property applied RadComboBox
      • Validation gives error when user try to enter a text that is not in the list.
      • Text is set to empty with OnClientBlurHandler when user try to enter a text that is not in the list.

    Main goal of this project is to use different implementations of RadComboBox in the same page.

  2. AEEBC20A-9B50-440B-8832-0FF4B08ECD2D
    AEEBC20A-9B50-440B-8832-0FF4B08ECD2D avatar
    2 posts
    Member since:
    Feb 2010

    Posted 21 Feb 2010 Link to this post

    Hi

    I seen u r  example article for required filed validation with radcombobox  ,but Radcombo with checkboxes is there whenever iam selecting tht checkboxes ,it is not selecting,required validator event is raised
    please help me .
  3. 8AECA7A5-3E26-4708-AD62-47AA92940523
    8AECA7A5-3E26-4708-AD62-47AA92940523 avatar
    6637 posts
    Member since:
    Sep 2012

    Posted 25 Feb 2010 Link to this post

    Hi sudhir,

    I tested the code library project with the current official version - 2009.3.1314, but everything worked as expected. Are there any specific steps that lead to the problem you experience?


    Best wishes,
    Peter
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  4. 42A09748-109F-4754-9FAD-204C8D33800E
    42A09748-109F-4754-9FAD-204C8D33800E avatar
    63 posts
    Member since:
    Aug 2012

    Posted 08 Mar 2010 Link to this post

    Greetings,

    The RadComboBox validator works fine for me in a standard page and also when using a MasterPageFile.
    However, we're now trying to use it with a CreateUserWizard control, where the required validator does not seem to be working.

    There's no problem validating the combobox on the server-side [accessing the control via - CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("cboCountries")] but we can't figure out a way to validate on the client-side.

    Using version 2009.3.1314.35 .

     

    <asp:CreateUserWizard ID="CreateUserWizard1" runat="server"   
    BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderStyle="Solid"   
    BorderWidth="1px" CellPadding="10" CellSpacing="10"   
    Font-Names="Verdana" Font-Size="12px"   
    EditProfileUrl="~/Default.aspx"   
    FinishDestinationPageUrl="~/Default.aspx"   
    ContinueDestinationPageUrl="~/Default.aspx">  
    <MailDefinition   
    Subject="Registration Completed"   
    BodyFileName="~/Admin/RegistrationCompleteMail.en.txt">  
    </MailDefinition> 
            <SideBarStyle BackColor="#5D7B9D" BorderWidth="0px" Font-Size="0.9em"   
                VerticalAlign="Top" /> 
            <SideBarButtonStyle BorderWidth="0px" Font-Names="Verdana" ForeColor="White" /> 
            <ContinueButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC"   
                BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"   
                ForeColor="#284775" /> 
            <NavigationButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC"   
                BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"   
                ForeColor="#284775" /> 
            <HeaderStyle BackColor="#5D7B9D" BorderStyle="Solid" Font-Bold="True"   
                Font-Size="0.9em" ForeColor="White" HorizontalAlign="Center" /> 
            <CreateUserButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC"   
                BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"   
                ForeColor="#284775" /> 
            <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> 
            <StepStyle BorderWidth="0px" /> 
            <WizardSteps> 
                <asp:CreateUserWizardStep runat="server" Title="Registrazione" ID="CreateUserWizardStep1">  
                    <ContentTemplate> 
                        <table border="0" cellpadding="3" cellspacing="3" style="font-family:Verdana;font-size:100%;">  
                            <tr> 
                                <td align="center" colspan="2" style="color:White;background-color:#5D7B9D;font-weight:bold; text-align: center;">  
                                    <asp:Label ID="lblCreateNewUser" runat="server"   
                                    Text="<%$ Resources:MainResource, CreateNewUser %>"></asp:Label></td>  
                            </tr> 
                            <tr> 
                                <td colspan="2" align="right" style="color: #FF0000; text-align: center;">  
                                    <asp:Label ID="lblRedFieldsAreRequired" runat="server"   
                                    Text="<%$ Resources:MainResource, RedFieldsAreRequired %>" /></td>  
                                  
                            </tr> 
                            <tr> 
                                <td align="right" style="color: #FF0000">  
                                    <asp:Label ID="lblUserName" runat="server" AssociatedControlID="UserName"   
                                    Text="<%$ Resources:MainResource, DesiredUserName %>">:</asp:Label> 
                                </td> 
                                <td> 
                                    <asp:TextBox ID="UserName" runat="server"></asp:TextBox> 
                                    <asp:RequiredFieldValidator ID="reqUserNameRequired" runat="server"   
                                        ControlToValidate="UserName" ErrorMessage="*"   
                                        ValidationGroup="CreateUserWizard1" /> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right" style="color: #FF0000">  
                                    <asp:Label ID="lblPassword" runat="server" AssociatedControlID="Password"   
                                    Text="<%$ Resources:MainResource, LoginPassword %>">Password:</asp:Label> 
                                </td> 
                                <td> 
                                    <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox> 
                                    <asp:RequiredFieldValidator ID="reqPasswordRequired" runat="server"   
                                        ControlToValidate="Password" ErrorMessage="*"   
                                        ValidationGroup="CreateUserWizard1" /> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right" style="color: #FF0000">  
                                    <asp:Label ID="lblConfirmPassword" runat="server"   
                                    Text="<%$ Resources:MainResource, ConfirmPassword %>" 
                                        AssociatedControlID="ConfirmPassword">:</asp:Label> 
                                </td> 
                                <td> 
                                    <asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password"></asp:TextBox> 
                                    <asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server"   
                                        ControlToValidate="ConfirmPassword"   
                                        ErrorMessage="*"   
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right" style="color: #FF0000">  
                                    <asp:Label ID="lblEmail" runat="server"   
                                    Text="<%$ Resources:MainResource, Email %>" 
                                    AssociatedControlID="Email">E-mail:</asp:Label> 
                                </td> 
                                <td> 
                                    <asp:TextBox ID="Email" runat="server"></asp:TextBox> 
                                    <asp:RequiredFieldValidator ID="reqEmailRequired" runat="server"   
                                        ControlToValidate="Email" ErrorMessage="*"   
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> 
                                      
                                </td> 
                            </tr> 
                          
                            <tr> 
                                <td align="right">  
                                    <asp:Label ID="lblNameFirst" runat="server"   
                                    Text="<%$ Resources:MainResource, FirstName %>" 
                                    AssociatedControlID="txtNameFirst">First Name</asp:Label>:</td> 
                                <td> 
                                    <asp:TextBox ID="txtNameFirst" runat="server"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    <asp:Label runat="server" ID="lblNameMiddle" Text="<% Resources:MainResource, MiddleName %>">Middle Name</asp:Label>:</td> 
                                <td> 
                                    <asp:TextBox ID="txtNameMiddle" runat="server"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    <asp:Label runat="server" ID="lblNameLast" Text="<% Resources:MainResource, LastName %>">Last Name</asp:Label>:</td> 
                                <td> 
                                    <asp:TextBox ID="txtNameLast" runat="server"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    <asp:Label runat="server" ID="lblCompany" Text="<% Resources:MainResource, Company %>">Company</asp:Label>:</td> 
                                <td> 
                                    <asp:TextBox ID="txtCompanyName" runat="server"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    <asp:Label runat="server" ID="lblStreet" Text="<% Resources:MainResource, Street %>">Street</asp:Label>:</td> 
                                <td> 
                                    <asp:TextBox ID="txtStreet" runat="server"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    <asp:Label runat="server" ID="lblCity" Text="<% Resources:MainResource, City %>">City</asp:Label>:</td> 
                                <td> 
                                    <asp:TextBox ID="txtCity" runat="server"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    <asp:Label runat="server" ID="lblProvince" Text="<% Resources:MainResource, Province %>">Province</asp:Label>:</td> 
                                <td> 
                                    <asp:TextBox ID="txtProvince" runat="server"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    <asp:Label runat="server" ID="lblZip" Text="<% Resources:MainResource, Zip %>">Zip</asp:Label>:</td> 
                                <td> 
                                    <asp:TextBox ID="txtZip" runat="server" Width="75px"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    Country:</td> 
                                <td> 
                                    <telerik:RadComboBox ID="cboCountryCode_Ak"   
                                        runat="server" Width="150px" Height="175px" 
                                        EmptyMessage="Enter a Country"   
                                        EnableLoadOnDemand="True"   
                                        ShowMoreResultsBox="True" 
                                        EnableVirtualScrolling="True"   
                                        CausesValidation="False"   
                                        AllowCustomText="True"   
                                        MarkFirstMatch="True">  
                                        <WebServiceSettings Method="GetCountries" Path="GetCountries.asmx" /> 
                                     </telerik:RadComboBox> 
                                     <asp:RequiredFieldValidator ID="reqCountry"   
                                        ControlToValidate="cboCountryCode_Ak" runat="server" 
                                        ErrorMessage="*">  
                                     </asp:RequiredFieldValidator> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    <asp:Label runat="server" ID="lblPhone1" Text="<% Resources:MainResource, Phone %>">Phone</asp:Label> 1:</td> 
                                <td> 
                                    <asp:TextBox ID="txtPhone1" runat="server"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    <asp:Label runat="server" ID="Label1" Text="<% Resources:MainResource, Phone %>">Phone</asp:Label> 2:</td> 
                                <td> 
                                    <asp:TextBox ID="txtPhone2" runat="server"></asp:TextBox> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right" style="color: #FF0000">  
                                    <asp:Label runat="server" ID="Label2" Text="<% Resources:MainResource, ParentCode %>">Parent Distributor or Dealer Code</asp:Label>:</td> 
                                <td> 
                                    <asp:TextBox ID="txtParentCode" runat="server" Wrap="False"></asp:TextBox> 
                                    <asp:RequiredFieldValidator ID="reqParentCode" runat="server"   
                                        ControlToValidate="txtParentCode"   
                                        ErrorMessage="*"   
                                        ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> 
                                     
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="right">  
                                    &nbsp;</td> 
                                <td> 
                                    &nbsp;</td> 
                            </tr> 
                              
                            <tr> 
                                <td align="center" colspan="2">  
                                    <asp:CompareValidator ID="PasswordCompare" runat="server"   
                                        ControlToCompare="Password" ControlToValidate="ConfirmPassword"   
                                        Display="Dynamic" ErrorMessage="<%$ Resources:MainResource, PassCompareValidator %>"   
                                        ValidationGroup="CreateUserWizard1"></asp:CompareValidator> 
                                    <asp:RegularExpressionValidator ID="EmailRegExValidator" runat="server" ErrorMessage="<%$ Resources:MainResource, EmailValidValidator %>" ValidationGroup="CreateUserWizard1" ControlToValidate="Email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> 
                                      
                                </td> 
                            </tr> 
                            <tr> 
                                <td align="center" colspan="2" style="color:Red;">  
                                    <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal> 
                                </td> 
                            </tr> 
                        </table> 
                    </ContentTemplate> 
                </asp:CreateUserWizardStep> 
                <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server" Title="<%$ Resources:MainResource, RegistrationComplete %>" /> 
            </WizardSteps> 
        </asp:CreateUserWizard> 

     
    Any suggestion would be appreciated.

  5. 7ECFE2AE-669B-42F5-B863-CECDEE6FD6D6
    7ECFE2AE-669B-42F5-B863-CECDEE6FD6D6 avatar
    2992 posts
    Member since:
    Jul 2015

    Posted 11 Mar 2010 Link to this post

    Hello Chanan Zass,

    To easiest way to find the combobox on the client when it is embedded in a templated control is to use its OnClientLoad event.

    Kind regards,
    Veskoni
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.