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

[Solved] Looping a radgrid

3 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Edd
Top achievements
Rank 1
Edd asked on 24 Jul 2013, 10:26 AM
please i have a problem and wish someone can help me out.
How can i loop through a grid view and get all the rows and transfer the data into another page to print a receipt.
Thanks in advance

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Jul 2013, 11:12 AM
Hi Edd,

Please try the below code snippet,to access the rows of a radgrid.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" onprerender="RadGrid1_PreRender">
    <MasterTableView DataKeyNames="OrderID">
        <Columns>
            <telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" />
            <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" UniqueName="ShipCity" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
   {
       foreach (GridDataItem item in RadGrid1.Items)
       {
           string ID = item.GetDataKeyValue("OrderID").ToString();
           string shipcity = item["ShipCity"].Text;
       }    
   }

Thanks,
Princy
0
Edd
Top achievements
Rank 1
answered on 24 Jul 2013, 11:19 AM
how can i transfer this data unto another page in the form of a receipt like.
Thanks again
0
Eyup
Telerik team
answered on 29 Jul 2013, 08:12 AM
Hello Edd,

Please check out the following post:
http://www.telerik.com/community/forums/aspnet-ajax/grid/print-whole-radgrid-from-clientside-during-print.aspx#2605282

Hope this helps.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Edd
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Edd
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or