Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check if data has been changed
Message
From
02/11/2007 10:30:51
 
 
To
02/11/2007 09:45:11
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01265117
Message ID:
01266081
Views:
8
This site is for ASP.net datagrid, but maybe it will help point you in the right direction:

http://www.datagridgirl.com/default.aspx


>Hi Bonnie
>I am using the DataGridView.
>
>>>How do you use this method to enable or disable the toolbar buttons.? If the user makes changes in a textbox or a grid.
>>
>>The grid is the culprit here ... in a TextBox, as soon as the TextBox loses focus (and it's various Validating and Validated events fire), the DataRowVersion should no longer be Proposed. I think there's some events in the grid that you might be able to utilize, but I rarely use a grid and so I'm no expert there. And now that there are two grid classes, you'd have to specify if you're using the old DataGrid or the new DataGridView. Which one are you using?
>>
>>~~Bonnie
>>
>>
>>
>>
>>
>>>>Hi Eduardo,
>>>>
>>>>>It works fine if I change record. Dataset.Haschanges(), seems to do the same.
>>>>>But for it to work the user has to move from the record. If he makes modifications to the data and close the form, Rowset or Haschanges are not aware of the change.
>>>>>What I am trying to do is Enable a save button from my datanavigator as soon as the user modifies a field in the form.

>>>>
>>>>There's a little "gotcha" with this, and it's caused when the data in a row has been left in a Proposed state.
>>>>
>>>>Data in a DataRow has several different versions. First, there's the original version. Then, when it's being edited, it becomes a Proposed version and once it's done being edited it becomes the Current version. Sometimes when editing, the row is left in the Proposed state and needs to be ended.
>>>>
>>>>Here's a method I *always* call before I attempt to save data:
>>>>
>>>>
>>>>protected virtual void CommitProposedChanges(DataSet ds)
>>>>{
>>>>	if (ds == null)
>>>>		return;
>>>>
>>>>	for (int nTable = 0; nTable < ds.Tables.Count; nTable++)
>>>>	{
>>>>		for (int nRow = 0; nRow < ds.Tables[nTable].Rows.Count; nRow++)
>>>>		{
>>>>			if (ds.Tables[nTable].Rows[nRow].HasVersion(DataRowVersion.Proposed))
>>>>			{
>>>>				ds.Tables[nTable].Rows[nRow].EndEdit();
>>>>			}
>>>>		}
>>>>	}
>>>>}
>>>>
>>>>
>>>>Without calling the above method, .HasChanges() could return a false when in fact there is a Proposed change just waiting to be committed.
>>>>
>>>>~~Bonnie
>>>
>>>Thanks for your time Bonnie, it works perfectly, when I close the form.
>>>
>>>How do you use this method to enable or disable the toolbar buttons.? If the user makes changes in a textbox or a grid.
>>>
>>>Thanks for your help

(On an infant's shirt): Already smarter than Bush
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform