Retrieving the value of a column in the row being updated

4 posts, 1 answers
  1. Phani Musale
    Phani Musale avatar
    24 posts
    Member since:
    Jan 2010

    Posted 16 Mar 2010 Link to this post


    Is there a way by which I can retrive the value of a column of a row, in the Updating() event of the sql data source control? I am trying to set the parameters of the stored procedures on updating event. And the value of one of the parameters will be from one of the columns of the row being updated.

  2. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 16 Mar 2010 Link to this post

    If it's automatically passed in the SqlDataSource's Update command, then I'm sure you can access it from the e.Command.Parameters list.

    Like so:

    object column1 = e.Command.Parameters["column1"].Value;

    I hope that helps.
  3. DevCraft R3 2016 release webinar banner
  4. Phani Musale
    Phani Musale avatar
    24 posts
    Member since:
    Jan 2010

    Posted 16 Mar 2010 Link to this post

    Thanks for the reply.
    But sorry, it's seems that my question was not clear enough. HEre is the scenario:
    - I have a radGrid
    - It has Editmode as inline
    - The grid has 4 columns, "email" being one of them
    - On the grid I have  GridEditCommandColumn which allows me to edit and update each row.
    - The grid is populated by a sql data source
    - After editing, when I click Update, the Updating event of the sql datasource gets fired
    - In here, I need to access the email field in the grid for row being updated.

    I tried the way you suggested, but it is only for parameters in the sql datasource <UpdateParameters>  tag.

    Any further help will be much appreciated

  5. Answer
    Veli avatar
    2002 posts

    Posted 19 Mar 2010 Link to this post

    Hi Phani,

    If you add an update parameter for the Mail field in your SqlDataSource, and the Mail field is one of the updated fields in the item, I believe you can find the field value in the e.Command.Parameters collection.

    If you do not want to do that, here is another approach:

    string email = ((RadGrid1.EditItems[0] as GridEditableItem).EditManager.GetColumnEditor("Email") as GridTextBoxColumnEditor).Text;

    The above snippet is used to find the value of a field named Email shown in a GridBoundColumn in RadGrid. The example accesses the first edited item in the grid, which is fine when you have a single editable item at a time.  If you enabled AllowMultiRowEdit="true", you will need to know which edited item in the EditItems collection is your item.

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top