Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I work with master page in that there are one HyperLink.i set that HyperLink NavigateUrl form (master page's) child page.

for that i use this code in child page.

C#
HyperLink hl = (HyperLink)this.Master.FindControl("linkviewmysite");
 hl.NavigateUrl = "../" + ds.Tables[0].Rows[0]["username"].ToString();
 Response.Redirect("Siteadmindata.aspx", false);

here linkviewmysite is the id of master page's HyperLink.

now problem is when i set NavigateUrl it's not work.

But when is remove this line (Response.Redirect("Siteadmindata.aspx", false);) from code than navigateurl set and HyperLink is work fine for me.

so now what should i do for it with Response.Redirect.
Posted
Comments
Dholakiya Ankit 22-Jul-13 2:39am    
Response.Redirect("Siteadmindata.aspx", false);
means you are redirecting to particular source so you are not suppose to do that what you want explain me in detail
[no name] 22-Jul-13 2:40am    
"Siteadmindata.aspx" this page also child page of same master page
Dholakiya Ankit 22-Jul-13 2:51am    
but siteadimdata.aspx when u request it it will load master page once again thats why ur navigation does not working
[no name] 22-Jul-13 2:55am    
yes now i get it. but any solution for it ?
Dholakiya Ankit 22-Jul-13 2:59am    
you are changing navigation url y?

1 solution

HyperLink hl = (HyperLink)this.Master.FindControl("linkviewmysite");
session["user_name"] = ds.Tables[0].Rows[0]["username"].ToString();
Response.Redirect("Siteadmindata.aspx", false);

now in master page page load


(!postback)
{
if(session["user_name"]!=null)
{
linkviewmysite.navigationurl=session["user_name"].tostring();
}

}


try it........
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900