Hola,
I'm currently developing a form using a radgrid to allow users to register multiple guests for an event. Each row in the grid is a guest and the grid is editable to allow the users to add their own guests.
Two of the columns are Age & GuestOption
I have age being validated so that if they enter an age is needs to be less than 18. But, I also need to validate based on the option the select in the GuestOption drop down.
I'm trying to use a custom validator, but I need to be able to have access to both the value in the Age column & the value in the GuestOption drop down. Is there an easy way for me to access both those values during the validation? I can just do this all after the post the form, but I would prefer to do this with validation so that they cannot enter invalid data from the get go.
thanks,
-Jon
I'm currently developing a form using a radgrid to allow users to register multiple guests for an event. Each row in the grid is a guest and the grid is editable to allow the users to add their own guests.
Two of the columns are Age & GuestOption
<telerik:GridTemplateColumn UniqueName="Age" HeaderText="Age (Child Only)"> |
<ItemTemplate> |
<asp:Label runat="server" ID="lblAge" Text='<%# Bind("Age") %>'></asp:Label> |
</ItemTemplate> |
<EditItemTemplate> |
<asp:TextBox runat="server" ID="editAge" Text='<%# Bind("Age") %>' Width="20px"></asp:TextBox> |
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="editAge" runat="server" ValidationExpression="^[0-1]?[0-7]$" ErrorMessage="Whole numbers, under 18"></asp:RegularExpressionValidator> |
</EditItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridDropDownColumn DataField="GuestOptionsID" DataSourceID="GuestOptionsDataSource" |
HeaderText="Options" ListTextField="GuestOption" ListValueField="GuestOptionsID" |
UniqueName="GuestOption" ColumnEditorID="GuestOptionsIDEditor"> |
</telerik:GridDropDownColumn> |
<asp:SqlDataSource ID="GuestOptionsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:edu_yale_som_alumnireunion_connectionstring %>" |
ProviderName="System.Data.SqlClient" SelectCommand="SELECT [GuestOptionsID], [GuestOption] FROM [GuestOptions] WHERE Visible='true' order by DisplayOrder"> |
</asp:SqlDataSource> |
I have age being validated so that if they enter an age is needs to be less than 18. But, I also need to validate based on the option the select in the GuestOption drop down.
I'm trying to use a custom validator, but I need to be able to have access to both the value in the Age column & the value in the GuestOption drop down. Is there an easy way for me to access both those values during the validation? I can just do this all after the post the form, but I would prefer to do this with validation so that they cannot enter invalid data from the get go.
thanks,
-Jon