Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Using Datarow, how do I get the data out of each

Reply
Thread Tools

Using Datarow, how do I get the data out of each

 
 
Dave
Guest
Posts: n/a
 
      02-12-2004
column in the current row? For example, I have a datagrid
filled up with a database and the user clicks on the edit
button. I want to go to another page and edit this row.
How do I get the data from this row? I dont want to get
the data from the grid row, but the current row of my
dataset. Please help! Thanks.
Dave
 
Reply With Quote
 
 
 
 
Marshal Antony
Guest
Posts: n/a
 
      02-13-2004
Hi Dave,
You can get the data from a datarow,
If dr is the datarow,
dr["columname"] will give you the value of the column in the
datarow or if you know
the index you can use dr[index])(index can be starting from 0,1,2,.....).
If you want to iterate through each row in the datarowcollection
in the datatable in the dataset,
If ds is the dataset,

foreach(DataRow dr in ds.Tables[0].Rows)

{

access each column value here like the way I described above.

}

Hope this helps.

Marshal Antony

..NET Developer

http://www.dotnetmarshal.com






"Dave" <> wrote in message
news:f2d701c3f12f$167e2ab0$...
> column in the current row? For example, I have a datagrid
> filled up with a database and the user clicks on the edit
> button. I want to go to another page and edit this row.
> How do I get the data from this row? I dont want to get
> the data from the grid row, but the current row of my
> dataset. Please help! Thanks.
> Dave



 
Reply With Quote
 
 
 
 
Dave Tessitore
Guest
Posts: n/a
 
      02-13-2004

Hi Marshal. Thanks for the reply.. I did this and it works!

DataTable dt = ds.Tables[0];
DataRow[] dr = dt.Select();
textFIRST.Text = dr[0]["FNAME"].ToString();
textLAST.Text = dr[0]["LNAME"].ToString();
textPHONE.Text = dr[0]["PHONE_NUMB"].ToString();

Thanks.
Dave



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Transform a 2D color image into 2 images of (R1,G1,B) at each pixelof image 1 and (R2,G2,B) at each pixel of image2 for STEREO visualization 88888 Dihedral C++ 10 12-23-2011 02:28 PM
Array#each - getting each element and the index Pat Maddox Ruby 6 01-20-2006 04:04 PM
how do i? Full scan of each control in each grid row cell John Blair ASP .Net 1 08-03-2005 11:02 AM
xsl:for-each for each 3 elements problem Tjerk Wolterink XML 3 11-03-2004 05:22 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57