PC Review


Reply
Thread Tools Rate Thread

DataGrid Updating DataSource

 
 
John zink
Guest
Posts: n/a
 
      20th Aug 2003
I have a datagrid that displays a few columns from a table.
I need to be able to update a process date on each row if
any of the displayed columns get updated. The process
date ("UPDT_DT") is not in the datagrid. I put an event
handler on the textboxes in the grid so I can capture when
a change occurs, but I can't seem to get the process date
column updated.
Here is the code I tried:
CType
(Me.BindingContextdgLists.DataSource, "UW_LISTS").Current,
DataRowView).Row.Item("UPDT_DT") = Date.Now

The line of code executes but when "UPDT_DT" is updated it
resets the row in the data grid.

Any ideas of how to accomplish this task ?
 
Reply With Quote
 
 
 
 
Dmitriy Lapshin [C# / .NET MVP]
Guest
Posts: n/a
 
      21st Aug 2003
Hi John,

First of all, this piece looks a little bit "alien" to me:

> Me.BindingContextdgLists.DataSource


I'd suggest to ensure that the right source is referenced by this property -
just to be safe.

Second, you might try to call AcceptChanges on a row after the
ProcessingDate gets updated. The reason is that the grid's binding manager
could just roll back your change when data grid pushes updated data back to
the data source.

Third, you may try to handle DataView's ListChanged event instead and react
on ItemChanged notifications.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software

"John zink" <(E-Mail Removed)> wrote in message
news:0d9e01c3672b$1afb5740$(E-Mail Removed)...

> I have a datagrid that displays a few columns from a table.
> I need to be able to update a process date on each row if
> any of the displayed columns get updated. The process
> date ("UPDT_DT") is not in the datagrid. I put an event
> handler on the textboxes in the grid so I can capture when
> a change occurs, but I can't seem to get the process date
> column updated.
> Here is the code I tried:
> CType
> (Me.BindingContextdgLists.DataSource, "UW_LISTS").Current,
> DataRowView).Row.Item("UPDT_DT") = Date.Now
>
> The line of code executes but when "UPDT_DT" is updated it
> resets the row in the data grid.
>
> Any ideas of how to accomplish this task ?


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
DataGrid ItemStyle is a textbox and doesn't update the datagrid datasource matthew schouppe Microsoft ASP .NET 3 30th Apr 2004 04:02 PM
DataGrid Update not Updating the DataSource =?Utf-8?B?QmlsbCBTYWxsaW5n?= Microsoft Dot NET 9 5th Feb 2004 03:01 PM
Updating datasource from a DataGrid filled with join statement Markus Heid Microsoft ADO .NET 1 8th Dec 2003 10:49 AM
dataview.datasource not binding or updating datagrid Ben Microsoft Dot NET 1 30th Jul 2003 06:31 AM
cast datagrid.datasource to dataset (datasource is table) newsgroper@yahoo.com Microsoft Dot NET Framework Forms 1 4th Jul 2003 04:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:42 AM.