复制代码 代码如下:
<ext:Grid ID="gridEcUser" runat="server" EnableCheckBoxSelect="false" EnableRowNumber="true"
Title="用户管理" AllowPaging="True"
onpageindexchange="gridEcUser_PageIndexChange" PageSize="10"
onrowdatabound="gridEcUser_RowDataBound" DataKeyNames="UserId">
<Toolbars>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="btnAddEcUser" runat="server" Text="添加" Icon="Add">
</ext:Button>
<ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</ext:ToolbarSeparator>
<ext:Button ID="btnToHome" runat="server" Text="首页" OnClick="btnToHome_Click" Icon="House">
</ext:Button>
</Items>
</ext:Toolbar>
</Toolbars>
<Columns>
<ext:BoundField HeaderText="用户ID" Width="50px" Hidden="true" DataField="UserId" ColumnID="UserId" />
<ext:BoundField HeaderText="姓名" Width="150px" ExpandUnusedSpace="True" DataField="FullName" ColumnID="FullName" />
<ext:BoundField HeaderText="登陆用户名" Width="150px" DataField="LoginName" ColumnID="LoginName" />
<ext:BoundField HeaderText="用户组" Width="150px" ColumnID="RolesFullName" DataField="RolesFullName" />
<ext:CheckBoxField HeaderText="用户状态" Width="80px" ColumnID="IsOpen" DataField="IsOpen" />
<ext:LinkButtonField HeaderText="" Width="60px" ColumnID="ModiUser" Text="修改" CommandName="Modi" />
<ext:LinkButtonField HeaderText="" Width="60px" ColumnID="DelUser" Text="删除" CommandName="Del" ConfirmIcon="Question" ConfirmText="确认要删除用户吗?" ConfirmTitle="易彩国际" />
</Columns>
</ext:Grid>
C#代码:
复制代码 代码如下:
//数据绑定:
//说明:列的DataField名称要与DataTable中的字段名称一致。
DataTable UserDt = UserBLL.GetEcUserList();
gridEcUser.DataSource = UserDt;
gridEcUser.DataBind();
代码
复制代码 代码如下:
protected void gridEcUser_RowDataBound(object sender, ExtAspNet.GridRowEventArgs e)
{
DataRow Dr = e.DataItem as DataRow;
if (Dr != null)
{
bool IsOpen = Convert.ToBoolean(Dr["IsOpen"]);
if (IsOpen) e.Values[4] = "<img src='../Images/png-0010.png' style='width:16px;text-align:center'";
else e.Values[4] = "<img src='../Images/png-0012.png' style='width:16px;'";
}
Grid中列内容居中的方法:
复制代码 代码如下:
<ext:BoundField HeaderText="姓名" Width="150px" ExpandUnusedSpace="True" DataField="FullName" ColumnID="FullName" DataFormatString="<div style='text-align:center;width:100%'>{0}</div>" />
Grid的RowCommand事件中获得列值:
1:在Grid的DataKeyNames中设置行关键字,如:DataKeyNames="UserId,UserName"
2:
代码
复制代码 代码如下:
protected void gridEcUser_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e)
{
if (e.CommandName == "Modi") //修改
{
string DD = gridEcUser.DataKeys[e.RowIndex][0].ToString();
ExtAspNet.Alert.Show(DD);
}
else if (e.CommandName == "Del")//删除
{
}
}
<ext:Grid ID="gridEcUser" runat="server" EnableCheckBoxSelect="false" EnableRowNumber="true"
Title="用户管理" AllowPaging="True"
onpageindexchange="gridEcUser_PageIndexChange" PageSize="10"
onrowdatabound="gridEcUser_RowDataBound" DataKeyNames="UserId">
<Toolbars>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="btnAddEcUser" runat="server" Text="添加" Icon="Add">
</ext:Button>
<ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</ext:ToolbarSeparator>
<ext:Button ID="btnToHome" runat="server" Text="首页" OnClick="btnToHome_Click" Icon="House">
</ext:Button>
</Items>
</ext:Toolbar>
</Toolbars>
<Columns>
<ext:BoundField HeaderText="用户ID" Width="50px" Hidden="true" DataField="UserId" ColumnID="UserId" />
<ext:BoundField HeaderText="姓名" Width="150px" ExpandUnusedSpace="True" DataField="FullName" ColumnID="FullName" />
<ext:BoundField HeaderText="登陆用户名" Width="150px" DataField="LoginName" ColumnID="LoginName" />
<ext:BoundField HeaderText="用户组" Width="150px" ColumnID="RolesFullName" DataField="RolesFullName" />
<ext:CheckBoxField HeaderText="用户状态" Width="80px" ColumnID="IsOpen" DataField="IsOpen" />
<ext:LinkButtonField HeaderText="" Width="60px" ColumnID="ModiUser" Text="修改" CommandName="Modi" />
<ext:LinkButtonField HeaderText="" Width="60px" ColumnID="DelUser" Text="删除" CommandName="Del" ConfirmIcon="Question" ConfirmText="确认要删除用户吗?" ConfirmTitle="易彩国际" />
</Columns>
</ext:Grid>
C#代码:
复制代码 代码如下:
//数据绑定:
//说明:列的DataField名称要与DataTable中的字段名称一致。
DataTable UserDt = UserBLL.GetEcUserList();
gridEcUser.DataSource = UserDt;
gridEcUser.DataBind();
代码
复制代码 代码如下:
protected void gridEcUser_RowDataBound(object sender, ExtAspNet.GridRowEventArgs e)
{
DataRow Dr = e.DataItem as DataRow;
if (Dr != null)
{
bool IsOpen = Convert.ToBoolean(Dr["IsOpen"]);
if (IsOpen) e.Values[4] = "<img src='../Images/png-0010.png' style='width:16px;text-align:center'";
else e.Values[4] = "<img src='../Images/png-0012.png' style='width:16px;'";
}
Grid中列内容居中的方法:
复制代码 代码如下:
<ext:BoundField HeaderText="姓名" Width="150px" ExpandUnusedSpace="True" DataField="FullName" ColumnID="FullName" DataFormatString="<div style='text-align:center;width:100%'>{0}</div>" />
Grid的RowCommand事件中获得列值:
1:在Grid的DataKeyNames中设置行关键字,如:DataKeyNames="UserId,UserName"
2:
代码
复制代码 代码如下:
protected void gridEcUser_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e)
{
if (e.CommandName == "Modi") //修改
{
string DD = gridEcUser.DataKeys[e.RowIndex][0].ToString();
ExtAspNet.Alert.Show(DD);
}
else if (e.CommandName == "Del")//删除
{
}
}
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“ExtAspNet GridPanel的一般用法”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。