binding to datasource and stored procedures

2 posts, 0 answers
  1. Roy
    Roy avatar
    36 posts
    Member since:
    Jun 2008

    Posted 17 Aug 2008 Link to this post

    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...
  2. Yavor
    Yavor avatar
    11 posts

    Posted 20 Aug 2008 Link to this post

    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,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
Back to Top