This is a migrated thread and some comments may be shown as answers.

get databound value(column) from databound in radgrid

3 Answers 410 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ARUN RAJA
Top achievements
Rank 1
ARUN RAJA asked on 28 Jul 2010, 12:06 PM
Hi
   how to get databound value(column) from databound event in telerik radgrid

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Jul 2010, 12:18 PM
Hello Arun,

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


Thanks,
Princy.
0
Muhammad Farooq
Top achievements
Rank 1
answered on 07 May 2015, 09:55 AM
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>
 <Columns>
 <telerik:GridBoundColumn HeaderText="Area" DataField="Area" UniqueName="Area">
 <HeaderStyle Width="80px" />
 </telerik:GridBoundColumn>
 <telerik:GridButtonColumn UniqueName="Project_Code" HeaderText ="Project Code" DataTextField="Project_Code" CommandName="Select">
 <HeaderStyle Width="300px" />
 </telerik:GridButtonColumn>
 <telerik:GridBoundColumn HeaderText="Rating" DataField="Rating" UniqueName="Rating">
 </telerik:GridBoundColumn> <telerik:GridButtonColumn UniqueName="2014" HeaderText ="2014" DataTextField="2014" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Jan" HeaderText ="Jan" DataTextField="Jan" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Feb" HeaderText ="Feb" DataTextField="Feb" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Mar" HeaderText ="Mar" DataTextField="Mar" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Apr" HeaderText ="Apr" DataTextField="Apr" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="May" HeaderText ="May" DataTextField="May" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Jun" HeaderText ="Jun" DataTextField="Jun" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Jul" HeaderText ="Jul" DataTextField="Jul" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Aug" HeaderText ="Aug" DataTextField="Aug" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Sep" HeaderText ="Sep" DataTextField="Sep" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Oct" HeaderText ="Oct" DataTextField="Oct" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Nov" HeaderText ="Nov" DataTextField="Nov" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Dec" HeaderText ="Dec" DataTextField="Dec" CommandName="Select">
 </telerik:GridButtonColumn>
 <telerik:GridButtonColumn UniqueName="Grnad Total" HeaderText ="GRAND_TOTAL" DataTextField="GRAND_TOTAL" CommandName="Select" HeaderStyle-Wrap="true">
 </telerik:GridButtonColumn>
 </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" />
 </ClientSettings>
 <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_WebBlue"
EnableImageSprites="True">
 </HeaderContextMenu>
</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,
0
Eyup
Telerik team
answered on 12 May 2015, 08:38 AM
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:
http://www.telerik.com/help/aspnet-ajax/grid-getting-cell-values-for-selected-rows-client-side.html

2. Add the fields you want to access in the ClientDataKeyNames collection and use the getDataKeyValue to access the data:
http://www.telerik.com/help/aspnet-ajax/grid-extract-key-values-client-side.html

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:
http://www.telerik.com/help/aspnet-ajax/grid-accessing-cells-and-rows.html

You can also check these articles:
http://www.telerik.com/help/aspnet-ajax/grid-retrieve-primary-key-field-values-for-items.html


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.

Regards,
Eyup
Telerik
 

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

 
Tags
Grid
Asked by
ARUN RAJA
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Muhammad Farooq
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or