访问母版页控件不起作用 [英] Access master page control not work

查看:73
本文介绍了访问母版页控件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用母版页,因为有一个HyperLink.i设置了HyperLink NavigateUrl表格(母版页)的子页面。



我使用此代码在子页面中。



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.

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



这里linkviewmysite是母版页HyperLink的ID。



现在的问题是当我设置NavigateUrl它不起作用。



但什么时候从代码中删除这一行(Response.Redirect(Siteadmindata.aspx,false);)比使用导航设置和HyperLink对我来说工作正常。



所以现在应该用Response.Redirect做什么。


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.

推荐答案

HyperLink hl =(HyperLink)this.Master.FindControl(linkviewmysite);

session [user_name] = ds.Tables [0] .Rows [0] [username]。ToString();

Response.Redirect(Siteadmindata.aspx,false);



现在在主人页面加载





(!回发)

{

if( session [user_name]!= null)

{

linkvie wmysite.navigationurl = session [user_name]。tostring();

}



}

< br $> b $ b

试试........
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........


这篇关于访问母版页控件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆