急急急!!! js 隐藏 gridview 超链接
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<a target="_blank" href="">查看邮件</a>
<a href="" target="_blank" runat="server">回复</a>
</ItemTemplate>
</asp:TemplateField>
如果没有查看邮件的权限,如何把“查看邮件”这列隐藏??
[解决办法]
for (int i = 0; i < this.RepeaterResource.Items.Count; i++) { HtmlAnchor ha = this.RepeaterResource.Items[i].FindControl("hh") as HtmlAnchor; if (Ismanage()) { ha.Disabled = false; ha.HRef = UIHelper.GetCooperateLink(COOPERATE_ID, string.Format(@"/Portal/Research/Cooperate/ResourceDetail.aspx?RES_ID={0}&FUN_CODE=Cooperate_Resource&COOPERATE_ID={1}", ID, FUN_EXT1)); } else { if (cooperInfo.ISOPEN == "1") { ha.Disabled = false; ha.HRef = UIHelper.GetCooperateLink(COOPERATE_ID, string.Format(@"/Portal/Research/Cooperate/ResourceDetail.aspx?RES_ID={0}&FUN_CODE=Cooperate_Resource&COOPERATE_ID={1}", ID, FUN_EXT1)); } else { ha.Attributes.Add("onclick", "AlertMsg('此协作组为非公开,请先加入协作组再试!')"); } } }
[解决办法]
例子,上面的,遍历控件取得<a>标签,判断权限,链接写到后台,给提示,就好了
要结贴,呵呵
[解决办法]
<ItemTemplate>
<div id="test">
<a target="_blank" href="">查看邮件</a>
</div>
<a href="" target="_blank" runat="server">回复</a>
</ItemTemplate>
然后控制div的display:none 、 block
[解决办法]
用三元运算符?:
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<%#Eval("CanDoSomething").ToString()=="1"?"可以查看的HTML":""%>
</ItemTemplate>
</asp:TemplateField>