0

I have as asp.net c# web forms application in which I have a gridview. I need to update the doc_rvw_sub_status_set_by field with the current user when updating. Here is the update command in the sql data source for the gridview:

UpdateCommand="UPDATE [tbl_doc_rvw_sub] 
                    SET [doc_rvw_sub_status_list] = @doc_rvw_sub_status_list,
                        [doc_rvw_sub_status_set_by] = ,
                        [doc_rvw_sub_status_dt_set] = GetDate()
                    WHERE   [doc_rvw_sub_id_pk] = @original_doc_rvw_sub_id_pk"

Here are the update parameters in the sql data source:

<UpdateParameters>
            <asp:Parameter Name="original_doc_rvw_sub_status_list" Type="Int32" />
            <asp:Parameter Name="doc_rvw_sub_status_set_by" Type="String" />
            <asp:Parameter Name="doc_rvw_sub_status_dt_set" Type="DateTime" />
        </UpdateParameters>

I'm not sure how to get the value for System.Web.HttpContext.Identity.Name into the doc_rvw_sub_status_set_by field. Please let me know if additional information is required.

ebram khalil
  • 8,252
  • 7
  • 42
  • 60
user1916528
  • 379
  • 4
  • 23
  • Pass it using the asp.net special tags like `<%: HttpContext.Current.User.Identity.Name %>` – Izzy Dec 04 '15 at 15:20
  • I tried adding the special tag to the update command but I get an error stating that I have incorrect syntax near <. – user1916528 Dec 04 '15 at 15:34
  • 1
    easiest to do in code behind http://stackoverflow.com/questions/3863802/how-to-use-user-identity-name-as-a-parameter-for-sqldatasource-in-asp-net – Joe Dec 04 '15 at 16:19

0 Answers0