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

binding to datasource and stored procedures

1 Answer 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roy
Top achievements
Rank 1
Roy asked on 17 Aug 2008, 12:34 PM
Hello again,

The first order of business when using rad grid was binding it to an SqlDataSource.
After Read/Learning the examples (which used a custom data source called "SessionDataSource"), i've set to work.
Setting the select command to a sp/fn was easy enough.
When i tried to set a sp for the update command, there were always problems issued from the amount of parameters (even if the datasource created them itself after i configured it to the relevent sp).
After a few broken keyboards :) i changed the select command to CommandText, and executed the sp thus:
Exec sp @sp_param1 = @grid_param1....
Finally it worked.

Be advised, after looking through relevent threads, i noticed some suggested one should use an event to pull the data from the grid and run a sql command to update.
Is it really the best way to do it? The relevent examples showed using the editedItem.Controls as the source of data, but this might cause errored type casting of controls.

I'd appreciate any reply. I'd like to improve the current setting, although it works fine...

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 20 Aug 2008, 08:25 AM
Hi Roy,

Basically, this decision is mostly a matter of preference. In the second approach which you mentioned, one can use the UpdateCommand for the control, to extract the newly entered data. Then, you can alter the UpdateCommand for the underlying datasource object, and execute the update directly. Some people find this to be a more straightforward approach. I also think that in some scenarios this may be a suitable option.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Roy
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or