Reg;:代码behing中的锚标签可见性 [英] Reg;:anchor tag visiblity in code behing
问题描述
Aspx页面中的我的Anchor标签:
< a id = angerBonusPoints href = ../ MyHome / UserBonusPoints.aspx rel = external data-role = 按钮 样式 = visibility:hidden data-icon = gear data-theme = a class = bonus runat = server > 奖励积分
i已给出 visibility = hidden
所以它的工作正常标签按钮不会在所有页面中显示
但是我希望这个锚点按钮可见一个特定的页面如何做到这一点。
我的Code behiind页面休闲:
if (Request.FilePath.ToString()。ToLower()。Contains( / myhome / home))
{
angerBonusPoints.Visible = true ;
angerBonusPoints.Attributes.Add( href, 〜/ MyHome / UserBonusPoints.aspx);
}
i希望该锚点按钮只显示一页,但不起作用。
请完成需要
问候,
Madhu
< blockquote>从标签的HTML中删除
style =visibility:hidden
然后使用
Visible = false ;
您想隐藏它的位置和
Visible = 真跨度>;
您想要在哪里显示它。
在runat =server
属性到锚标记。设置属性后,您将能够通过代码访问锚标记。在那里你可以设置锚标记的可见
属性为true
或false
。
试试这个:
< a id = angerBonusPoints runat = server href = ../ MyHome / UserBonusPoints.aspx rel = external data-role = 按钮 visible = false data-icon = gear data-theme = a 类 = 奖金>奖励积分 < / a >
C#:
angerBonusPoints.Visible = true ; // 使锚点可见
angerBonusPoints.Visible = 假跨度>; // 隐藏锚
My Anchor tag in Aspx page:
<a id="angerBonusPoints" href="../MyHome/UserBonusPoints.aspx" rel="external" data-role="button" style="visibility: hidden" data-icon="gear" data-theme="a" class="bonus" runat="server">Bonus Points
i have given visibility= hidden
so its working fine tag button is not visibiling in all pages
but i want this anchor button to be visible for one specific page how to do this.
my Code behiind page fallows:
if (Request.FilePath.ToString().ToLower().Contains("/myhome/home"))
{
angerBonusPoints.Visible = true;
angerBonusPoints.Attributes.Add("href", "~/MyHome/UserBonusPoints.aspx");
}
i want that anchor button to be visible for the only one page but its not working.
pls do the need full
Regards,
Madhu
Removestyle="visibility: hidden"from the HTML of your tag and then use
Visible = false;
wherever you want to hide it and
Visible = true;
wherever you want to show it.
Atrunat="server"
property to the anchor tag. After setting the property you'll able to access anchor tag through code. There you can setVisible
property of anchor tag totrue
orfalse
.
Try this:
<a id="angerBonusPoints" runat="server" href="../MyHome/UserBonusPoints.aspx" rel="external" data-role="button" visible="false" data-icon="gear" data-theme="a" class="bonus">Bonus Points</a>
C#:
angerBonusPoints.Visible = true; //For making anchor visible angerBonusPoints.Visible = false; //For hiding anchor
这篇关于Reg;:代码behing中的锚标签可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!