HowTo: retrieve a datarow in the dataGrid update handler

A

Alex

How can I retrieve a DataRow from the DataGrid in the update handler?
Can I do this or do I need to construct one?
 
S

Scott Mitchell [MVP]

Alex said:
How can I retrieve a DataRow from the DataGrid in the update handler?
Can I do this or do I need to construct one?

Alex, what you do is grab the value in the DataGrid. How you get the
value for a particular column of the updated row depends on if the row
is a BoundColumn or a TemplateColumn. Examples for both types of
columns can be seen here:

http://datawebcontrols.com/faqs/ProgrammaticAccess/AccessingBoundColumnContents.shtml
http://datawebcontrols.com/faqs/ProgrammaticAccess/AccessingTemplateColumnContents.shtml

Happy Programming!

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
R

Rick Spiewak

If your datagrid is bound to a datatable, use e.item.datasetindex to get the
row index, then retrieve the data from that row in the datatable.
 
A

Alex

Is there a way to directly get an entire DataRow out of the grid?

e.g. DataRow x = ???DataGrid??? [e.Item.DataSetIndex]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,235
Latest member
Top Crypto Podcasts_

Latest Threads

Top