get databound value(column) from databound in radgrid

4 posts, 0 answers
    ARUN RAJA avatar
    20 posts
    Member since:
    May 2010

    Posted 28 Jul 2010 Link to this post

       how to get databound value(column) from databound event in telerik radgrid
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 Jul 2010 Link to this post

    Hello Arun,

    I believe the following docuemntation is enough to give an idea about how to accomplish this.
    Accessing cells and rows

  3. Muhammad Farooq
    Muhammad Farooq avatar
    1 posts
    Member since:
    May 2015

    Posted 07 May 2015 in reply to Princy Link to this post

    Hi Princy,I have a telerik grid with GridButtonColumn. I need the cell index and column name or column index of the selected cell. Below is the telerik grid which is bind at server side. <telerik:RadGrid ID="GridCR" runat="server"
    AutoGenerateColumns="False" BorderStyle="None" Skin="Outlook"
     Font-Names="verdana" Font-Size="8pt" GridLines="None" BorderWidth="1px"
    BorderColor="#6666FF" >
     <MasterTableView AutoGenerateColumns="false" TableLayout="Fixed" ><CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
     <telerik:GridBoundColumn HeaderText="Area" DataField="Area" UniqueName="Area">
     <HeaderStyle Width="80px" />
     <telerik:GridButtonColumn UniqueName="Project_Code" HeaderText ="Project Code" DataTextField="Project_Code" CommandName="Select">
     <HeaderStyle Width="300px" />
     <telerik:GridBoundColumn HeaderText="Rating" DataField="Rating" UniqueName="Rating">
     </telerik:GridBoundColumn> <telerik:GridButtonColumn UniqueName="2014" HeaderText ="2014" DataTextField="2014" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Jan" HeaderText ="Jan" DataTextField="Jan" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Feb" HeaderText ="Feb" DataTextField="Feb" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Mar" HeaderText ="Mar" DataTextField="Mar" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Apr" HeaderText ="Apr" DataTextField="Apr" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="May" HeaderText ="May" DataTextField="May" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Jun" HeaderText ="Jun" DataTextField="Jun" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Jul" HeaderText ="Jul" DataTextField="Jul" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Aug" HeaderText ="Aug" DataTextField="Aug" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Sep" HeaderText ="Sep" DataTextField="Sep" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Oct" HeaderText ="Oct" DataTextField="Oct" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Nov" HeaderText ="Nov" DataTextField="Nov" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Dec" HeaderText ="Dec" DataTextField="Dec" CommandName="Select">
     <telerik:GridButtonColumn UniqueName="Grnad Total" HeaderText ="GRAND_TOTAL" DataTextField="GRAND_TOTAL" CommandName="Select" HeaderStyle-Wrap="true">
     </Columns> </MasterTableView> <HeaderStyle Font-Names="verdana" Font-Size="8pt" ForeColor="Black"
    HorizontalAlign="Center" Font-Bold="True" /> 
    <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
     <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
     <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_WebBlue"
    </telerik:RadGrid> When the user will click on any of the cell, I need a column name of that cell.I also have attach the image, In the image if I click on third row, and 9th cell value i.e "1" then I should get the column name"Jun" and third row, second column value ("09-2013-FIN-01 - Revenue Accounting Function").Pl help.Regards,
  4. Eyup
    Eyup avatar
    3857 posts

    Posted 12 May 2015 Link to this post

    Hi Muhammad,

    A. You can achieve this requirement on the client-side:

    1.You can access and handle the column data as a regular column - with eventArgs.get_item().get_cell("ColumnUniqueName").

    You can also use the getCellByColumnUniqueName method:

    2. Add the fields you want to access in the ClientDataKeyNames collection and use the getDataKeyValue to access the data:

    For your convenience, I am also sending a sample RadGrid web site to demonstrate an actual implementation of the described approaches.

    B. Server-side access.

    Once you have the GridDataItem accessed through the SelectedItems collection in this scenario, you can access any TableCell value:

    You can also check these articles:

    Hope this helps.
    If you have different requirements or further instructions, please provide the exact requirements step by step and I may prepare a new sample RadGrid web site to demonstrate the specific scenario.


    See What's Next in App Development. Register for TelerikNEXT.

Back to Top