使用模版列来控制在一个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>

以上的代码实现的效果是,如果当前这条记录"已审核"则在该行中不显示审核连接,反之则显示"审核"连接,

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    }

以上的代码则可以控制有"A"权限的人才可以看到第一列

posted @ 2007-04-19 18:00  chinaifne  阅读(374)  评论(0编辑  收藏  举报