Hey folks.
I have a grid that may contain 0 or more combo boxes in one of the coumns of each row.
What I am trying to do is validate the data held by each combo when the form is submitted.
Originally I had this:
I want to change the drop down list to a telerik combo box. Items will inserted into the combo box dynamically.
I'd like to validate the selection using some kind of validator. I saw examples of validating telerik combos using custom validators.
If I use custom validators it seems like I could use one validator where the validator method could simply iterate through the grid looking to see if a combo is enabled in the row and then check to see if it has a valid value; if not it could set the text of a label that sits beside the combo, using find control of the row, to a red * or something.
A nicer implementation might be, I would think, if each combo had it's own custom validator where the validator method can get the client side instance of the telerik combo that it is set to validate; or the combo that is in the same grid row as the validator that is doing the validation. That way if it is invalid the validator will simply show itself as a red *. Can the custom validator get a specific instance of a combo? Is this solution possible?
Thanks.
mat.t.
I have a grid that may contain 0 or more combo boxes in one of the coumns of each row.
What I am trying to do is validate the data held by each combo when the form is submitted.
Originally I had this:
| <telerik:GridTemplateColumn UniqueName="DataValue" DataField="DataValue" SortExpression="DataValue" HeaderText="<%$ Resources:Default, DATA_VALUE_HEADER_TEXT %>"> |
| <EditItemTemplate> |
| <asp:TextBox ID="txtDataValue" |
| runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.DataValue") %>' |
| Width="150px"> |
| </asp:TextBox> |
| <asp:RequiredFieldValidator |
| ID="rf_txtDataValue" |
| runat="server" |
| ErrorMessage = "You must enter a value" |
| Text = "*" |
| Enabled="false" |
| Visible= "true" |
| ControlToValidate="txtDataValue" |
| Display="Dynamic"/> |
| <asp:DropDownList ID="ddlDataValue" |
| runat="server" |
| Width="155px"></asp:DropDownList> |
| <asp:RequiredFieldValidator ID="rf_ddlDataValue" |
| runat="server" |
| ErrorMessage = "You must select a value" |
| Text = "*" |
| Enabled="false" |
| Visible= "true" |
| InitialValue ="<%$ Resources:Default, DEFAULT_LIST_ITEM_VALUE %>" |
| ControlToValidate="ddlDataValue" |
| Display="Dynamic" /> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
I want to change the drop down list to a telerik combo box. Items will inserted into the combo box dynamically.
I'd like to validate the selection using some kind of validator. I saw examples of validating telerik combos using custom validators.
If I use custom validators it seems like I could use one validator where the validator method could simply iterate through the grid looking to see if a combo is enabled in the row and then check to see if it has a valid value; if not it could set the text of a label that sits beside the combo, using find control of the row, to a red * or something.
A nicer implementation might be, I would think, if each combo had it's own custom validator where the validator method can get the client side instance of the telerik combo that it is set to validate; or the combo that is in the same grid row as the validator that is doing the validation. That way if it is invalid the validator will simply show itself as a red *. Can the custom validator get a specific instance of a combo? Is this solution possible?
Thanks.
mat.t.