BrianNDN
asked on
<asp:LoginName> tag value, used as parameter in SqlDataSource ???
Hi,
Wondering, is there a way I can ...
Use the UserName value that is returned from Code Snippet One (the asp:LoginName tag)
and use it as a parameter in my SqlDataSource later on the page ...
I basically need the userName obtained from the LoginName tag placed in code Snippet 2 at the marker _Parameter, but have been unable to achieve this so far, I've tried it a couple of ways ... like this ... and also in the code, but have encounted no success.
any Ideas?
Wondering, is there a way I can ...
Use the UserName value that is returned from Code Snippet One (the asp:LoginName tag)
and use it as a parameter in my SqlDataSource later on the page ...
I basically need the userName obtained from the LoginName tag placed in code Snippet 2 at the marker _Parameter, but have been unable to achieve this so far, I've tried it a couple of ways ... like this ... and also in the code, but have encounted no success.
any Ideas?
Code Snippet One:
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
UserName <asp:LoginName ID="LoginName1" runat="server" />
</LoggedInTemplate>
</asp:LoginView>
<p>Please select a folder to upload your file to. <b>If no folder is selected file will be placed in the default folder.</b></p>
<asp:GridView ID="GridView_FolderName_Selector" runat="server" AutoGenerateColumns="False" AllowPaging="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:TemplateField HeaderText="Selection">
<ItemTemplate>
<asp:CheckBox ID="FolderNameSelector" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FolderName" HeaderText="FolderName"
SortExpression="FolderName" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ConnectionStrings:LocalSqlServer%>"
SelectCommand="SELECT [FolderName] FROM [FolderPermissions] WHERE UserName = _Parameter"></asp:SqlDataSource>
ASKER
I've done that in the cs file and played with it, but wasn't seeming to get it to work.
Can that be inserted like:
SelectCommand="SELECT [FolderName] FROM [FolderPermissions] WHERE UserName = User.Identity.Name"></asp: SqlDataSou rce>
??? if so, Do I need to put it as: @User.Identity.Name
?
Thanks
Can that be inserted like:
SelectCommand="SELECT [FolderName] FROM [FolderPermissions] WHERE UserName = User.Identity.Name"></asp:
??? if so, Do I need to put it as: @User.Identity.Name
?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
User.Identity.Name