0

I am using a datagridview with edit and delete auto generated.

I would like to use in my select statement my session user as a parameter.

When I do that, it doesn't display anything.

SelectCommand="SELECT DISTINCT .... WHERE AgentID = @UserID">

<SelectParameters>
    <asp:Parameter Name ="Session['UserID']"></asp:Parameter>
</SelectParameters>

How I declare my session: I tried it and it's working well.

   Session["UserID"] = (int)cmd.ExecuteScalar();

1 Answer 1

1

You can use asp sessions parameter:

<asp:SessionParameter Name="randomname" Type="string" SessionField="UserID" DefaultValue="your default value"/>

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.