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

how to get GridBoundColumn values in code behind using Radgrid

10 Answers 2473 Views
Grid
This is a migrated thread and some comments may be shown as answers.
senthil kumar
Top achievements
Rank 1
senthil kumar asked on 07 Jan 2010, 12:23 PM
Hi All,

I am new using Telerik controls
in my page i am using Radgrid controls and edit the radgrid "InPlace" mode.
I had one template column and three GridBoundcolumn.
In code behind how can i get the column value using vb.net

My aspx page is below

<telerik:RadGrid ID ="rgSkills" runat ="server" DataSourceID ="sdsEmployee"  AutoGenerateColumns="False" EnableAjax="true" OnInsertCommand ="rgSkills_InsertCommand"

OnUpdateCommand ="rgSkills_UpdateCommand" OnNeedDataSource ="rgSkills_NeedDataSource"

EnableValidation ="True" GridLines="None">

<MasterTableView  GridLines ="None" DataSourceID ="sdsEmployee" DataKeyNames ="emp_skill_set_id"

EditMode="Inplace" AutoGenerateColumns ="False" CommandItemDisplay ="Top" runat ="server"

allowcustompaging="False" allownaturalsort="False" AllowAutomaticUpdates ="false">

<Columns>

<telerik:GridTemplateColumn  DataField="Skill Description" HeaderText="Skills" >

<ItemTemplate>

<asp:LinkButton id="Skills" runat="server" text='<%# Eval("Skill Description") %>'

CommandName ="Update" />

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName ="EditCommandColumn"

EditText ="Edit" />

<telerik:GridBoundColumn   UniqueName="Skill Description" DataField="Skill Description"

HeaderText="Skill Set Rating" ItemStyle-Font-Size ="Smaller" >

</telerik:GridBoundColumn>

<telerik:GridBoundColumn   UniqueName="Comment" DataField="Comment" HeaderText="Comment"

ItemStyle-Font-Size ="Smaller" >

</telerik:GridBoundColumn>

'

'

'

'


In code behind is

proteced sub rgSkills_UpdateCommand(source As Object, e As GridCommandEventArgs)
{
 'here how to get the boundcolumn value

}
end sub


thanks

psk


10 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 08 Jan 2010, 02:36 PM
Hi Senthil,

You could get the column value of the GridBoundColumn in the UpdateCommand event handler with the following code snippet:

Protected Sub RadGrid1_UpdateCommand(source As Object, e As GridCommandEventArgs)
    Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
    Dim itemValue As String = item("ColumnUniqueName").Text
End Sub

For more information about accessing cells and rows you could check out this online documentation article:

http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html

I hope this helps.

Greetings,
Radoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mahmoud
Top achievements
Rank 1
answered on 23 Apr 2011, 02:06 AM
Hi Admin,

I tried your solution, I only get empty string, any ideas?

Thanks!
-m
0
Jayesh Goyani
Top achievements
Rank 2
answered on 23 Apr 2011, 06:16 AM
HI
 GridEditableItem editedItem = e.Item as GridEditableItem;

String strTemp = (editedItem["ColumnUniqueName"].Controls[1] as TextBox).Text;
String strTemp = (editedItem["ColumnUniqueName"].Controls[0] as TextBox).Text;
Thanks, Jayesh Goyani
0
Mahmoud
Top achievements
Rank 1
answered on 23 Apr 2011, 01:40 PM
Hey Jayesh,

works like a magic, except that I had to use Controls[0], since the collection has only one control.

Thanks again.

-m
0
Monica
Top achievements
Rank 1
answered on 14 Feb 2012, 08:23 PM

Hi Jayesh Goyani !
I need some help...
I have a question

GridEditableItem editedItem = e.Item as GridEditableItem;

 

 

String strTemp = (editedItem["ColumnUniqueName"].Controls[1] as TextBox).Text;

String strTemp = (editedItem["ColumnUniqueName"].Controls[0] as TextBox).Text;



Can I get the ID´s  of those textbox?

 

I am getting null... I am on the ItemCreated event.

Thanks,
M.

0
Princy
Top achievements
Rank 2
answered on 15 Feb 2012, 05:42 AM
Hello,

ItemCreated is fired before the item is data-bound. Therefore no data is available in the cells' text or input controls. Try the same in ItemDataBound event as explained in this documentation.

Thanks,
Princy.
0
Sathish
Top achievements
Rank 1
answered on 11 Dec 2019, 02:28 PM

what are the difference between telerik version 2019 and version 2013

please tell me 

waiting for your answer 

0
Peter Milchev
Telerik team
answered on 12 Dec 2019, 11:43 AM

Hello Sathish,

I am sharing the answer from your support thread regarding the differences: 

When upgrading the Telerik version, please follow the very detailed instructions in the following help article: Upgrade to a Newer Version of Telerik® UI for ASP.NET AJAX.

Before starting an upgrade of your project, you may find it useful to review the following resources:
  • The Known Issues and Important Changes sticky thread. It lists changes that may affect your code and known regression issues (that are usually fixed in the subsequent release). Review the information for the releases you go through so you can evaluate whether you will be affected by anything.
  • The Telerik Upgrade API Analyzer can analyze your C# code to notify you of changes between your version and the new version you want to upgrade to. It offers information as of the Q1 2012 (2012.1.225) release.
  • UI for ASP.NET AJAX Release History—reviewing the release notes for all releases you go through will let you see what has changed, what fixes, features and controls have been implemented so you are better prepared to meet your project's challenges.

Regards,
Peter Milchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Sathish
Top achievements
Rank 1
answered on 24 Jan 2020, 11:06 AM

i have one problem is there 
i.e RadGrid 2nd time is not coming RadGrid 

i am converting telerik 2013,visual studio2010 telerik 2019,visual 2017
radgrid is not populating 2nr time plss tell me

 

0
Rumen
Telerik team
answered on 27 Jan 2020, 09:43 AM

Hi Sathish,

Can you please provide more information on your setup and scenario? Can you provide a sample code to reproduce the problem?

Please check for any JavaScript errors in the console and also disable the AJAX if the grid is ajaxified as suggested in this article

Get more descriptive errors by disabling AJAX?

 

Regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Tags
Grid
Asked by
senthil kumar
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Mahmoud
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Monica
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Sathish
Top achievements
Rank 1
Peter Milchev
Telerik team
Rumen
Telerik team
Share this question
or