Handle the Updating event to perform additional initialization operations that are specific to your application, to validate the values of parameters, or to change the parameter values before the Sql Data Source control performs the update operation.You can, however, cancel the database operation by setting the Cancel property of the Sql Data Source Command Event Args to Important Values are inserted into parameters without validation, which is a potential security threat.ALTER PROCEDURE users_Update Faculty @EMAIL NVARCHAR(100), @ISLOCKEDOUT BIT, @MOBILENUMBER BIGINT, @USERNAME nvarchar(100) AS BEGIN UPDATE aspnet_Users SET [email protected] where [email protected] UPDATE ASPNET_MEMBERSHIP SET EMAIL = @EMAIL, LOWEREDEMAIL = LOWER(@EMAIL), [email protected] WHERE USERID = (SELECT USERID FROM ASPNET_USERS WHERE [email protected]) END Found the solution: The Select Columns and the Update Parameters should match in order to update using Sql Data Source, that means if you select(query or procedure) is returning 3 fields in gridview, then all of them should be the parameter for the update, you can miss out the actual updations in database if not required, but the I dont think your solution is OK, since I have to use the atribute Old Values Parameter Format String="original_" that means that I would have doble parameters, the ones with the original values and the ones with edited values. I have 4 parameters, Im getting the right values for 2 of them, an null at the others. Read this: The order of the parameters in the Update Parameters collection might be important, depending on the ADO. If not, this should resolve your problem right, protected void Grid View1_Row Updating(object sender, Grid View Update Event Args e) ALTER PROCEDURE [Human Resources].[usp Update Employee Gender] @Employee ID1 [int], @Gender [nchar](1) AS BEGIN UPDATE [Human Resources].[Employee] SET [Gender] = @Gender WHERE [Employee ID] = @Employee ID1; END Hi, Even I got the same error when I changed Employee Id to Employee ID1, but I solved this in different way.I have a very simple setup that should work fine per documentation.Use the Updating event to validate parameter values before executing the query.
There is a field "num", which is the primary key of the underlying table.
However, my gridview control will not properly update using the updatecommand of the sqldatasource. I'd like to be able to see a table of results in my gridview, click edit on any particular record, modify the data, then click update.
What I find is happening is that my parameters are not being updated when I go into edit mode, change the text of the "first Name" field, and click update.
AARP_DATA_D1_Bill Matri It still gets the old values, when I loop thru the Dictionary and in debug step thru it I see it still gets the original values not the new values that the user enters when they are changing each item.
// Iterate through the New Values collection and HTML encode all // user-provided values before updating the data source. New Values) guru_sami, sorry it took me so long to get back, I have been off on vacation and just got back, but yes you are right on, I went back and debugged the entire postback and it was rebinding the grid on postback on the page_load event.
In the On Updating method of the sqldatasource, I've stepped through the command parameters collection and it always contains the original values, not what I've typed into the editable textboxes in my grid.