C#
|--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
C#
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
C#
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.


Sanjay KumarRank #561 · 4.3K reputationPosted Dec 2, 2013, 12:33 AM EST
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