Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Filter > find combobox

Not answered find combobox

Feed from this thread
  • Posted on Nov 1, 2011 (permalink)

    I have a radcombobox in itemtemplate of grid.how to access the datakeyvalue?

    Reply

  • Posted on Nov 1, 2011 (permalink)

    Hello Tina,

    Try the following code snippet in SelectedIndexChanged event of RadComboBox.
    C#:
    protected void combo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
      RadComboBox combo = (RadComboBox)sender;
      GridDataItem item = (GridDataItem)combo.NamingContainer;
      string id = Convert.ToInt32(item.GetDataKeyValue("ID")).ToString();
    }

    Thanks,
    Shinu.

    Reply

  • Posted on Nov 2, 2011 (permalink)

    Thanks Shinu.
    But i want to access hte row in which combobox is present and then access the datakeyvalue.how can it be done?

    Reply

  • Posted on Nov 3, 2011 (permalink)

    Hello Tina,

    In order to get the datakeyvalue, attach the event OnClientSelectedIndexChanged from server side and pass the index.
    C#:
    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
         {
            GridDataItem dataItem = (GridDataItem)e.Item;
            RadComboBox combo = (RadComboBox)dataItem.FindControl("Radcombo");
           int index = e.Item.ItemIndex;
           combo.OnClientSelectedIndexChanged = "function (sender,args){rowIndex('" + index + "');}";             
         }
    }

    Javascript:
    function rowIndex(index)
    {
       var row = $find('<%= RadGrid1.ClientID %>').get_masterTableView().get_dataItems()[index];
       alert(row.getDataKeyValue("ID"));//DataKeyName
    }

    Thanks,
    Shinu.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Filter > find combobox
Related resources for "find combobox"

ASP.NET Filter Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]