|--main.master
|-- index.aspx
|-- user.master
|-- login.aspxmeans master page of user.master is main.master, master page of login page is user.master i have a loginview control on main.master page. code for loginview as
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ <a href="~/PageCommon/login.aspx" id="HeadLoginStatus" runat="server" color="#87cfe6">Log Ina> ]
AnonymousTemplate>
<LoggedInTemplate>
Welcome <span class="bold">
<asp:HyperLink ID="HyperLink1" ForeColor="PeachPuff" Font-Size="Larger" ToolTip="MyHome" runat="server"> <asp:LoginName ID="HeadLoginName" runat="server" />asp:HyperLink>
span>
[
<asp:LoginStatus ID="HeadLoginStatus" ForeColor="#87cfe6" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/PageCommon/index.aspx" />
]
LoggedInTemplate>
asp:LoginView>now in code behind of login page i want to access the hyperlink of login view to change the nevigate url of that hyperlink . but i am unable to access the hyperlink . i used this code to access the hyperlink
if (User.Identity.IsAuthenticated)
{
HyperLink rdirect = (HyperLink)Master.FindControl("HyperLink1");
int index = utype.SelectedIndex;
if (index == 0)
{
rdirect.NavigateUrl = ResolveUrl("~/PageUser/MyProfile.aspx");
}
else if (index == 1)
{
rdirect.NavigateUrl = ResolveUrl("~/PageAdmin/MyProfile.aspx");
}
}master page of login page is user.master , and master page for user.master is main.master.
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Sanjay KumarPosted Dec 2, 2013, 5:33 AM
http://stackoverflow.com/questions/3594143/dynamically-set-hyperlink-controls-navigateurl-property-inline
http://stackoverflow.com/questions/17360537/asphyperlink-navigate-url-adding-relative-path-to-the-url
http://asp-net-example.blogspot.in/2009/04/how-to-set-change-hyperlink-navigate.html