how to get GridBoundColumn values in code behind using Radgrid

10 posts, 0 answers
  1. senthil kumar
    senthil kumar avatar
    1 posts
    Member since:
    Jan 2010

    Posted 07 Jan 2010 Link to this post

    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


  2. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 08 Jan 2010 Link to this post

    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.
  3. Mahmoud
    Mahmoud avatar
    8 posts
    Member since:
    Mar 2011

    Posted 22 Apr 2011 Link to this post

    Hi Admin,

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

    Thanks!
    -m
  4. Jayesh Goyani
    Jayesh Goyani avatar
    2733 posts
    Member since:
    May 2010

    Posted 23 Apr 2011 Link to this post

    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
  5. Mahmoud
    Mahmoud avatar
    8 posts
    Member since:
    Mar 2011

    Posted 23 Apr 2011 Link to this post

    Hey Jayesh,

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

    Thanks again.

    -m
  6. Monica
    Monica avatar
    4 posts
    Member since:
    Nov 2011

    Posted 14 Feb 2012 Link to this post

    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.

  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Feb 2012 Link to this post

    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.
  8. Sathish
    Sathish avatar
    2 posts
    Member since:
    Dec 2019

    Posted 11 Dec 2019 Link to this post

    what are the difference between telerik version 2019 and version 2013

    please tell me 

    waiting for your answer 

  9. Peter Milchev
    Admin
    Peter Milchev avatar
    636 posts

    Posted 12 Dec 2019 Link to this post

    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.
  10. Sathish
    Sathish avatar
    2 posts
    Member since:
    Dec 2019

    Posted 16 minutes ago in reply to senthil kumar Link to this post

    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

     

Back to Top