Example of RadComboBox in RadGrid

5 posts, 0 answers
  1. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 25 Sep 2008 Link to this post

    I have a grid where the values for one of the columns should be unique across all rows. I want to make it so that when they edit a row, the drop list for that column filters out the previously selected items so that it is not possible to add or change a row which would create a duplicate.

    The column in question is a GridTemplateColumn which contains a RadComboBox. Right now, I'm resetting the DataSource and calling DataBind on the combobox in the grid's ItemDataBound event (when the item is a GridEditableItem).

    However, when I hit the InsertCommand or UpdateCommand events, the SelectedValue of the combobox is always empty.

    Is there is an example that demonstrates the dynamic loading of a RadComboBox used in a GridTemplateColumn in which the combo box is loaded at runtime based on the existing row's values and demonstrates the inserting and updating? That means no use of DataSource objects like ObjectDataSource, AccessDataSource, SessionDataSource etc. in the example.

  2. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 29 Sep 2008 Link to this post

    Hello Thomas,

    How you can set the SelectedValue when RadComboBox is placed inside RadGrid you can see here.
    You can also set the SelectedValue property of RadComboBox in ItemDataBound event of RadGrid.

    How you can insert and update items you can see here.

    Regards,
    Rosi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 29 Sep 2008 Link to this post

    I discovered the problem and it apparently had nothing to do with my approach. In general, I have used the ItemDataBound event to populate the combo and am able to get the combo's SelectedValue property in the InsertCommand and UpdateCommand. The problem I was encountering is that the grid itself was getting rebound.

    Here was the scenario. I have a screen with three or four comboboxes at the top of a form and a grid of results below. Previously, I had the system updating the grid when someone changed any of the comboboxes. I was also using an AjaxProxy. When I fired one of the comboboxes, the system was firing the SelectedIndexChanged event for all of the other comboboxes! Since each of those event handlers rebound the grid, the grid was getting rebound a bunch of times and the effect was that the SelectedValue property was always empty.
  5. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 30 Sep 2008 Link to this post

    Hello Thomas,

    Do you still experience the problem?

    All the best,
    Rosi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 30 Sep 2008 Link to this post

    Tough to say as I reworked the page to use a button. I.e., instead of triggering a refresh of the grid off the combo's SelectedIndexChanged event, I had the refresh trigger off a single button's Click event.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017