Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How we check for not empty dataset?
Message
 
 
To
08/09/2008 22:27:30
John Baird
Coatesville, Pennsylvania, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01345899
Message ID:
01346036
Views:
11
>>We're setting GridView dataset in code. Originally it was defined in the page in SQLDataSource and the Delete worked by itself using DeleteCommand of SQLDataSource.
>>
>>Now I'm not sure how can I handle it. Do you know if there is a way to somehow specify DeleteCommand for DataSet?
>
>I'm not sure I understand what you are asking. When a row is deleted in the grid, if the dataset is being used as its datasource, the row is marked for deletion in the datastate (rowstate = RowState.Deleted). When you pass the dataset back for update through a table adapter or a sql update command, the row is automatically deleted from sql server.

Originally we were using SQLDataSource. The DeleteCommand was set to be "Update People set Deleted = 1" In RowDeleted event there was a special handling to show a message with a button to undelete.

Since we switched to just DataSet for the GridView DataSource this functionality stopped working. My colleague added a code to delete a record in RowDeleting method using direct update of the data, but the code doesn't seem to work.

My original idea was to set Grid DataSource to SQLDataSource and somehow "refresh" the underlying DataTable when we retrieve a new DataSet. However, I never figured out if this is doable and in the meantime my colleague changed approach to always set GridView datasource to the DataSet.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform