Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to read items in Datagrid using c#
Message
From
17/01/2005 10:05:07
 
 
To
17/01/2005 01:59:11
General information
Forum:
ASP.NET
Category:
WebForms
Miscellaneous
Thread ID:
00977662
Message ID:
00977740
Views:
28
Noel,

VB uses parentheses where C# uses brackets. Try this instead:
      dg.Items.Item[i].Cells[1].Text
~~Bonnie

>Hi to all,
>
>I have here a VB.Net Code that read all items from the Datagrid and get the
>total.
>
>
>   Dim total as Double
>   For i = 0 To DataGrid1.Items.Count - 1
>      total = total + Convert.ToDouble(DataGrid1.Items.Item(i).Cells(1).Text)
>   Next
>
>
>But in C#, it seems that I can't find the Item(i).Cells(1).Text property.
>
>How do i convert this in C#.
>
>Here is my code in C#
>
>
>   for(int i=0; i<dg.Items.Count -1; i++)
>      {				
>	// Response.Write (dg.Items.Item(i).Cells(1).Text);
>        // the above code has an error...
>      }
>
>
>Can anyone help?
>
>Thanks.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform