Selected row cell value in raggrid

3 posts, 0 answers
  1. sho
    sho avatar
    24 posts
    Member since:
    Mar 2007

    Posted 04 Aug 2011 Link to this post


    My aspx page has radgrid and a dropdownlist. I want to populate this dropdownlist based on the value captured from a cell on selecting a single radgrid row.

    I have set AllowMultiRowSelection ="false"  and on clientsettings <Selecting AllowRowSelect="True"></Selecting>.

    How can I do this?

    Or if am using <ClientEvents OnRowSelected="RowSelected" /> and call some javascript I can get the cell value. How will I make use of this to populate the dropdown. The dropdown population is in codebehind.

  2. Jayesh Goyani
    Jayesh Goyani avatar
    2733 posts
    Member since:
    May 2010

    Posted 04 Aug 2011 Link to this post


    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" OnNeedDataSource="RadGrid1_NeedDataSource"
               <MasterTableView  DataKeyNames="ID">
                       <telerik:GridBoundColumn UniqueName="ID" HeaderText="ID" DataField="ID">
               <ClientSettings EnablePostBackOnRowClick="true">
                   <Selecting AllowRowSelect="true" />
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
            if (e.CommandName == "RowClick" && e.Item is GridDataItem)
                string strIdColumnText = ((GridDataItem)e.Item)["ID"].Text;
                // e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"]; // You can also take Id from DataKey
        protected void BindCombo(string strValue)
            // Bind your combo here

    let me know if this is not your case.

    Jayesh Goyani
  3. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 04 Aug 2011 Link to this post

    Hello sho,

    Try the following scenario using RadAjaxManager to populate DropDownList.
    <script type="text/javascript">
    function RowSelected(sender, eventArgs)
        var grid = sender;
        var MasterTable = grid.get_masterTableView(); var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
        var cell = MasterTable.getCellByColumnUniqueName(row, "EmployeeID");
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
       string val=e.Argument;
    protected void binddropdown(string strvalue)
         //Bind your dropdown here

Back to Top