使用模版列来控制在一个GridView中某些列有热连接,某些列无热连接
1
<asp:TemplateField HeaderText="审核">
2
<ItemStyle Width="30px" />
3
<ItemTemplate>
4
<%# (Convert.ToString(Eval("c_status")) == "已审核") ? "" : "<a href=" + "javascript:AudiBehavior(\"" + Eval("c_id") + "\")" + ">审核</a>"%>
5
</ItemTemplate>
6
</asp:TemplateField>
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
以上的代码实现的效果是,如果当前这条记录"已审核"则在该行中不显示审核连接,反之则显示"审核"连接,
1
protected void gvBehavior_RowCreated(object sender, GridViewRowEventArgs e)
2
{
3
if (Request.QueryString["MdLimitCode"].ToString().IndexOf("A")<0)
4
e.Row.Cells[0].Visible = false;
5
}
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
3
![](/Images/OutliningIndicators/InBlock.gif)
4
![](/Images/OutliningIndicators/InBlock.gif)
5
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
以上的代码则可以控制有"A"权限的人才可以看到第一列