How to show Value which one not containing in Combo box but brought in data source. - URGENT PLEASE

2 posts, 0 answers
  1. Manish
    Manish avatar
    74 posts
    Member since:
    Jul 2011

    Posted 16 Dec 2016 Link to this post

    For Better understaning my problem go through the Image I have attached.

    scenario is that I have two values in rad combo box 1 setting in Value field and 1 in Test Field and the 3rd one I have show in another label depending on selected value. 

    Means if I have 3 users and total marks 

    StudendId - Name - Total Marks

         1          -   Studend1 - 50

         2          -   Studend2 - 60

         3          -   Studend3 - 70

    Now I have show 70 in a separate label if I select Student3 to do this as it is only single value I don't want to make any round trip to server. Please help.


  2. Ivan Danchev
    Ivan Danchev avatar
    2053 posts

    Posted 20 Dec 2016 Link to this post

    Hello Manish,

    If you want to use a third field from the datatable (CellActiveArea) you can do so by setting it as a custom attribute to the ComboBox items. The following section of the documentation shows how this can be achieved. You need to subscribe to the ItemDataBound event and in its handler set the custom attribute:
    protected void RadComboBox1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
        DataRowView dataItem = (DataRowView)e.Item.DataItem;
        e.Item.Attributes["CellActiveArea"] = dataItem["CellActiveArea"].ToString();

    Then on the client you can use the item's client-side API to get the value from the item's custom attribute. Here's an example how this can be done in the ComboBox OnCLientSelectedIndexChanged event handler:
    function OnClientSelectedIndexChanged(sender, args) {
        var item = args.get_item();

    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top