Accessing row in Datagrid

5 posts, 0 answers
  1. Ammar
    Ammar avatar
    15 posts
    Member since:
    Apr 2008

    Posted 03 May 2008 Link to this post

    Hi All,
        
        In asp, usually, we can say myGridView.selectedRow.cells.item(1).text, howver, what's the equivalent expression for ajaxgrid.

    Thx in advanced
  2. Kiara
    Kiara avatar
    309 posts
    Member since:
    Jul 2006

    Posted 04 May 2008 Link to this post

    Ammar, I think that the equivalent syntax with the Telerik RadGrid is:

    CType(MyRadGrid.SelectedItems(0), GridDataItem)("<MyColumnUniqueName>").Text

    How to access data in RadGrid rows you can find out from these sources:

    http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Programming/AccessingCellsAndRows/DefaultCS.aspx
    http://www.telerik.com/help/radcontrols/aspnet%2Dajax/?grdAccessingCellsAndRows.html

    Kiara


  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 May 2008 Link to this post

    Hi Ammar,

    I tried with the following line of code in a Button click event to access the selected cell text.

    CS:
      protected void Button1_Click(object sender, EventArgs e)  
        {  
            string selecteditem = RadGrid1.SelectedItems[0].Cells[1].Text;  
     
       } 

    Thanks
    Princy.
  5. Ammar
    Ammar avatar
    15 posts
    Member since:
    Apr 2008

    Posted 05 May 2008 Link to this post

    Hi My friends

        I rtied both, but it always, says index out of range.
  6. Kiara
    Kiara avatar
    309 posts
    Member since:
    Jul 2006

    Posted 06 May 2008 Link to this post

    This can happen if you do not have selected rows in the grid since the SelectedItems collection is empty. Do you handle this case, what you found when you debugged your code?

    Kiara
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017