<asp:GridView ID="gvUserPower" runat="server" CellPadding="3" ForeColor="#333333"
GridLines="None" AutoGenerateColumns="False"
onrowdatabound="gvUserPower_RowDataBound">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="Userkey" HeaderText="工号" />
<asp:BoundField DataField="NACHN" HeaderText="用户" />
<asp:CheckBoxField HeaderText="查看" DataField="Ins" />
<asp:CheckBoxField HeaderText="写入" DataField="Query" />
<asp:CheckBoxField HeaderText="编辑" DataField="Edit" />
<asp:CheckBoxField HeaderText="删除" DataField="Del" />
<asp:CheckBoxField HeaderText="导出" DataField="Export" />
<asp:CheckBoxField HeaderText="打印" DataField="Pri" />
<asp:BoundField DataField="ModuleKey" HeaderText="模块编码" />
<asp:BoundField DataField="ModuleName" HeaderText="模块名称" />
<asp:CommandField HeaderText="操作" ShowDeleteButton="True"
ShowEditButton="True" />
</Columns>
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>读取数据的SQL语句:
select Userkey,NACHN,Ins,Query,Edit,Del,Export,Pri,ModuleKey,ModuleName
from Authority a
left join ZTA_HRDNET z on a.Userkey = z.Pernr
left join Groups g on g.ORGEH = z.ORGEH
left join Factory f on f.FactoryRkey = g.FactoryRkey查询的结果如下:
工号 姓名 Ins Query Edit Del Export Pri 模块编码 模块名称
1000042 cohen n y y n y n AllUserPower 用户权限注:Ins,Query,Edit,Del,Export,Pri,这个字段为字符型(char(2)).
y代表选中,n代表未先中.
GridLines="None" AutoGenerateColumns="False"
onrowdatabound="gvUserPower_RowDataBound">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="Userkey" HeaderText="工号" />
<asp:BoundField DataField="NACHN" HeaderText="用户" />
<asp:CheckBoxField HeaderText="查看" DataField="Ins" />
<asp:CheckBoxField HeaderText="写入" DataField="Query" />
<asp:CheckBoxField HeaderText="编辑" DataField="Edit" />
<asp:CheckBoxField HeaderText="删除" DataField="Del" />
<asp:CheckBoxField HeaderText="导出" DataField="Export" />
<asp:CheckBoxField HeaderText="打印" DataField="Pri" />
<asp:BoundField DataField="ModuleKey" HeaderText="模块编码" />
<asp:BoundField DataField="ModuleName" HeaderText="模块名称" />
<asp:CommandField HeaderText="操作" ShowDeleteButton="True"
ShowEditButton="True" />
</Columns>
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>读取数据的SQL语句:
select Userkey,NACHN,Ins,Query,Edit,Del,Export,Pri,ModuleKey,ModuleName
from Authority a
left join ZTA_HRDNET z on a.Userkey = z.Pernr
left join Groups g on g.ORGEH = z.ORGEH
left join Factory f on f.FactoryRkey = g.FactoryRkey查询的结果如下:
工号 姓名 Ins Query Edit Del Export Pri 模块编码 模块名称
1000042 cohen n y y n y n AllUserPower 用户权限注:Ins,Query,Edit,Del,Export,Pri,这个字段为字符型(char(2)).
y代表选中,n代表未先中.
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox cb = e.Row.FindControl("CheckBox1") as CheckBox;
}
}
模版列 checkbox Checked='<%# Eval("")%>'