Multiple ComboBoxes in RadGrid

3 posts, 1 answers
  1. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 16 Oct 2008 Link to this post

    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:

    <telerik:GridTemplateColumn UniqueName="DataValue" DataField="DataValue" SortExpression="DataValue" HeaderText="<%$ Resources:Default, DATA_VALUE_HEADER_TEXT %>">  
    <asp:TextBox    ID="txtDataValue"   
    runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.DataValue") %>' 
    ErrorMessage = "You must enter a value" 
    Text = "*" 
    <asp:DropDownList ID="ddlDataValue"   
    <asp:RequiredFieldValidator     ID="rf_ddlDataValue"   
    ErrorMessage = "You must select a value" 
    Text = "*" 
    InitialValue ="<%$ Resources:Default, DEFAULT_LIST_ITEM_VALUE %>" 
    Display="Dynamic" /> 

    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?


  2. Answer
    Blaize avatar
    88 posts
    Member since:
    Oct 2006

    Posted 17 Oct 2008 Link to this post

    Hey mat.t.,

    I think the "prometheus" combo supports validation out of the box? At least their example is showing that:


  3. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 17 Oct 2008 Link to this post

    Right on. Thanks, man. That's perfect. Never came across that compare validator sample but it seems obvious enough. very cool.

    I was trying with the custom validator and in that case I would need to know which combo box was being validated probably by looping through that colleciton of combos.

    In this case I let the compare validator worrry about that. Excellent.

Back to Top