how to loop through each record

4 posts, 0 answers
  1. ajmal
    ajmal avatar
    57 posts
    Member since:
    Oct 2006

    Posted 26 Nov 2010 Link to this post

    Hello All,

    I having a RadGrid and I'm executing below code to get all record in Grid,

    GridItem

     

    headerItem = grdADInbox.MasterTableView.GetItems(GridItemType.Header)[0];

     


    It is giving total rows by, please find attached.

    headerItem.OwnerTableView.DataSource

    now I need to loop it and read that??

    Please help.

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

    Posted 26 Nov 2010 Link to this post

    Hello Ajmal,

    If you want to loop through each record(items) in RadGrid, try the following code snippet.

    C#:
    foreach (GridDataItem item in RadGrid1.MasterTableView.Items)// loops through each record in grid
         {
     
         }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ajmal
    ajmal avatar
    57 posts
    Member since:
    Oct 2006

    Posted 26 Nov 2010 Link to this post

    I want to iterate the item in ItemDataBound method, while the count returen 0 rows.

    foreach loop is not working here?
  5. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 26 Nov 2010 Link to this post

    Hello Ajmal,

    It is not possible to iterate the items before they are created. You could use RadGrid_PreRender or Page_PreRender instead.

    Regards,
    Daniel
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top