This is a migrated thread and some comments may be shown as answers.

[Solved] OnUpdateCommand Edited Values are NULL

3 Answers 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Greg Smith
Top achievements
Rank 1
Greg Smith asked on 17 Sep 2009, 06:31 PM
I've done everything in the Insert/Update/Delete at database level with queries example and yet when I try to read the edited values they are always NULL/blank.

I have:

EnableViewState: true
All of the AllowAutomatic* set to false
I'm setting my DataSource in OnNeedDataSource

The edited values are ALWAYS null. As others have said, this is supposed to be a RAD tool. I'm trying to convince my team that these tools are the better than custom controls because they are faster and easier to implement. There needs to be a COMPLETE tutorial for doing custom CRUD commands because that is likely what 99.999% of your users are doing.


Thanks,
Greg

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Sep 2009, 07:28 AM
Hi Greg,

Can you try downloading the sample application from the following codelibrary submission and see whether you are able to access the editedvalues in the UpdateCommand event.
Manual Insert/Update/Delete operations using Auto-generated editform with sql statements from the code-behind

Thanks
Princy
0
Greg Smith
Top achievements
Rank 1
answered on 18 Sep 2009, 12:54 PM
Thanks for the links...I'll take a look at it to see if it will help.

I have another piece of information that might also be useful. When I run this code from the example the EmployeeID value IS set, but FirstName and LastName values are blank. When I set EnableViewState to false the values are populated with the old values. It seems as though the new/updated values are not being passed through to the code behind.

 protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)   
   {   
       
//Get the GridEditFormInsertItem of the RadGrid     
       
GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;   
 
       
//string EmployeeID = (insertedItem["EmployeeID"].Controls[0] as TextBox).Text;   
 
       
string LastName = (insertedItem["LastName"].Controls[0] as TextBox).Text;   
       
string FirstName = (insertedItem["FirstName"].Controls[0] as TextBox).Text;
...

Is there another boolean flag on a column or on the grid that has to be set?


Thank you,
Greg Smith
0
Greg Smith
Top achievements
Rank 1
answered on 18 Sep 2009, 03:10 PM
Princy,

Yes I downloaded the sample provided and was able to see the updated values. I will examine this code to see what my code is missing. Any help based on my previous post would be appreciated though ;)


Greg
Tags
Grid
Asked by
Greg Smith
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Greg Smith
Top achievements
Rank 1
Share this question
or