0
  <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
      ConnectionString="<%$ ConnectionStrings:FlowServerConnectionString %>" 
      SelectCommand="SELECT [RepGroup_Name], [RepGroup_ID] FROM [Rep_Group] WHERE [RepGroup_ID] in
            (SELECT [ID_RepGroup]
            FROM [FlowServer].[dbo].[Rep_Permission]
            WHERE [ID_User]=@ID_User)">
      <SelectParameters>
          <asp:ProfileParameter DefaultValue="" Name="ID_User" PropertyName="UserName" />
      </SelectParameters>

How to insert System.Web.HttpContext.Current.User.Identity.Name to my property "ID_User" (it's username here)

1 Answer 1

2

On your SqlDataSource1 add OnInit="SqlDataSource1_Init" then add the following event to the code behind:

protected void SqlDataSource1_Init(object sender, EventArgs e)
{
    this.SqlDataSource1.SelectParameters["ID_User"].DefaultValue = System.Web.HttpContext.Current.User.Identity.Name;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.