TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bo Wiklund
NA
23
0
How to reference a record in a DataTable from RowIndex in DataGrid or DataView
Oct 10 2003 11:33 AM
I am trying my first project in DOT NET and C# and I am developing an XML Web Service client with a main task to update records in a server. The client receives the databases from the server in form of XML DataSets (In server: return myDataSet.GetXml();). The Clients then recreates the DataSets and DataTables by reading the XML-files (In client: ds.ReadXml(xmlFileName); ) All well so far. The Client’s Window Form has a DataDrid for the user to navigation in the DataTable and TextBoxes for editing data. The TextBoxes are populated from the DataTable, guided by the RowIndex from the DataGrid (myGrid.CurrentRowIndex;) as the user clicks rows in the grid. Ex.: textBoxProductName.Text = tblProduct.Rows[rowIndex]["ProductName"].ToString(); When the TextBoxes are changed and the user confirms change then the client invokes a Web Service call to the server with the textboxes as parameters and requests update of the database. If the client receives back a successful response from the server then the textboxes will be copied into the DataTable in order to represent a “mirror” of the Server databases throughout the session. This works perfectly well as long as the DataGrid represents a copy of the DataTable (DataGrid rowIndex is the same as for DataTable rowindex). In the next step I have sophisticated a little by creating a DataView to sort and filter records and now myGrid.DataSource = myDataView. Here I have got my problem: How can I now read a cell in the Grid or DataView and locate the correct rownumber in the DataTable to populate my textBoxes. As it happens now the textboxes are populated with the wrong records from the DataTable, and if I invoke a server call there will be a complete mess in my databases. Is there any way out of this problem or do I have to completely change my logics in the program?
Reply
Answers (
3
)
Request File Transfer Codeing
Can .NET Remoting Make Sockets Obsolete?