c# - Access master page control not work -
i work master page in there 1 hyperlink
. set hyperlink
navigateurl
form (master page's) child page.
for use code in child page.
hyperlink hl = (hyperlink)this.master.findcontrol("linkviewmysite"); hl.navigateurl = "../" + ds.tables[0].rows[0]["username"].tostring(); response.redirect("siteadmindata.aspx", false);
here linkviewmysite
id of master page's hyperlink
.
now problem when set navigateurl
it's not work.
but when remove line (response.redirect("siteadmindata.aspx", false);
) code navigateurl set , hyperlink work fine me.
so should with response.redirect
.
i got answer
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
if(!postback) { if(session["user_name"]!=null) { linkviewmysite.navigationurl="../"+session["user_name"].tostring(); } }
Comments
Post a Comment