本文介绍了动态生成母版页面的页眉菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好我正在尝试以下代码动态生成标题,但没有在标题上获取任何内容... Plz帮助...
hello I am trying the following code to generate the header dynamically but not getting anything on header...Plz Help...
protected void Page_Load(object sender, EventArgs e)
{
ArrayList al = new ArrayList();
string[] aa = new string[] { "Abc", "Bfd", "Csd", "Has", "Pcd", "cdd", "Rep" };
switch (Session["Username"].ToString())
{
case "Admin":
LinkButton link1 = new LinkButton();
link1.Text = aa[0];
LinkButton link2 = new LinkButton();
link2.Text = aa[1];
LinkButton link3 = new LinkButton();
link3.Text = aa[2];
LinkButton link4 = new LinkButton();
link4.Text = aa[3];
LinkButton link5 = new LinkButton();
link5.Text = aa[4];
LinkButton link6 = new LinkButton();
link6.Text = aa[5];
LinkButton link7 = new LinkButton();
link7.Text = aa[6];
break;
case"User":
LinkButton link8 = new LinkButton();
link8.Text = aa[0];
LinkButton link9 = new LinkButton();
link9.Text = aa[1];
LinkButton link10 = new LinkButton();
link10.Text = aa[2];
LinkButton link11 = new LinkButton();
link11.Text = aa[3];
LinkButton link12 = new LinkButton();
link12.Text = aa[4];
break;
case"ReadOnly":
LinkButton link13 = new LinkButton();
link13.Text = aa[0];
break;
}
foreach (LinkButton s in al)
{
headerMenuTab.Controls.Add(s);
}
推荐答案
这篇关于动态生成母版页面的页眉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!