473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

find the DataRow associated with datagrid row

Hi,

Is there better way to find the DataRow associate with row of a datagrid?

Now I put ID column(PK) as a column in a datagrid, and get this cell value
of the datagrid current row (DataGrid.CurrentRowIndex), then use
DataTable.Rows.Find(id) to find the datarow.

I feel this way is not generic. Is there better way to find the associated
DataRow?

System internally must know how they are associated, since I can edit the
datatable value in datagrid.

Thanks!
Ryan
Feb 12 '06 #1
1 1540
Hi,

"Ryan Liu" <ad********@online.sh.cn> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Hi,

Is there better way to find the DataRow associate with row of a datagrid?

Now I put ID column(PK) as a column in a datagrid, and get this cell value
of the datagrid current row (DataGrid.CurrentRowIndex), then use
DataTable.Rows.Find(id) to find the datarow.

I feel this way is not generic. Is there better way to find the associated
DataRow?
Maybe this is what you want:

DataRowView currentRowView =
(DataRowView)BindingContext[dataGrid1.DataSource,
dataGrid1.DataMember].Current;
DataRow currentRow = currentRowView.Row;

HTH,
Greetings


System internally must know how they are associated, since I can edit the
datatable value in datagrid.

Thanks!
Ryan

Feb 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: NewSun | last post by:
How can i drag a datarow from a datagrid to a other control? e.g. Drag a datarow from a datagrid to a TextBox,Then display one colnumn' value of the datarow . Or Drag a cell's value to a controll...
3
by: Alex | last post by:
How can I retrieve a DataRow from the DataGrid in the update handler? Can I do this or do I need to construct one?
2
by: Josh | last post by:
Hi Guys, I have been stuck on this problem for several days now, i have a set of nested datagrids. Inside the second datagrid i have a dropdown list, a textbox and a label. I want the textbox...
3
by: Rich | last post by:
Hello, If my datagrid is based on a dataTable (t1) and the currency manager is also bound to t1 and I do a find on a key dim dRow As DataRow, t1 As DataTable .... dRow = t1.Rows.find(somekey)...
25
by: MadCrazyNewbie | last post by:
Hey Group, Im Sure this is simple but I carn`t seem to find any info anywhere:( I have 2 x Forms: Form 1 has a DataConnecter and several DataAdapters on it, all bound together in my DataSet. ...
0
by: Ryan Liu | last post by:
Hi, Is there better way to find the DataRow associate with row of a datagrid? Now I put ID column(PK) as a column in a datagrid, and get this cell value of the datagrid current row...
6
by: Derek | last post by:
The following code never finds a matching row even when one exists. It appears that the method thinks there is only one value being passed to the method even though the object array that is passed...
7
by: Nemisis | last post by:
Hi everyone, Can anyone tell me if it is possible to pass in a property of an object into a sub, and within that sub, find out the name of the item that was passed along with the property name??...
2
by: =?Utf-8?B?TWFyYw==?= | last post by:
In Visual Studio 2005, I am developing a Windows Mobile application, using Mobile SQL 2005. I need Data from a Database to be shown in a DataGrid, this works. But now I want to be able to get the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.