I am trying to create Dynamic link to user Profile, but it wont work as i expect.
i tryed this:
<li class='last' style="float:right"> <a id="loginLink2" runat="server" href="~/Profile/"+<asp:LoginName runat="server" />""
> ><asp:LoginName ID="LoginName1" runat="server" /> </a></l>> <asp:LoginStatus ID="LoginStatus1" runat="server" OnLoggedOut="LoginStatus1_LoggedOut"
> LogoutAction="Redirect" LogoutText="Log off" LogoutPageUrl="~/" />></li>
But its didnt work. How do i get around this problem? I could do it by ajax call to the server, but i want to avoid it if its possible.
You would have to manually set it from the server. You could do this on loading the page via:
((HtmlLink)LoginView1.FindControl("loginLink2")).href = "~/Profile/" +
this.User.Identity.Name;
The one part I don't know is what the server-side control that represents an <a runat="server">
... but everything else should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.