模板列传值到子窗体中,子窗体中多选gridview中checkbox保存数据多项到数据库中
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title> <script src="../../../Scripts/jquery.js" type="text/javascript" language="javascript"></script> <script src="../../../Scripts/jquery.foe.common.js" type="text/javascript"></script> <script src="../../../Scripts/jquery.foe.utils.js" type="text/javascript"></script> <script type="text/javascript" language="javascript">
function openpage(GroupID) {
OpenPage('Sys_UserGroupPermissionEmployeeInfo.aspx?GroupID=' + GroupID + '', '人员管理', '','');
}
function openwin(groupID) {
OpenPage('Sys_UserGroupPermissionInfo.aspx?GroupID=' + groupID + '', '权限管理', '', '');
}
</script> </head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="scriptManager" runat="server">
</telerik:RadScriptManager>
<table class="TableStyle">
<tr>
<th>
用户组名称:
</th>
<td>
<asp:TextBox ID="txtGroupName" runat="server" CssClass="Input">
</asp:TextBox>
</td>
<th>
用户组编码:
</th>
<td>
<asp:TextBox ID="txtGroupCode" runat="server" CssClass="Input"></asp:TextBox>
</td>
</tr>
</table>
<telerik:RadToolBar ID="toolBar" runat="server" Width="100%" OnButtonClick="toolBar_ButtonClick"
Height="22px">
<Items>
<telerik:RadToolBarButton Text="查询" ImageUrl="../../../Common/images/ToolBarIcons/search.png">
</telerik:RadToolBarButton>
</Items>
</telerik:RadToolBar>
<telerik:RadGrid AlternatingItemStyle-CssClass="AlterLine" ID="dgGroups" runat="server"
AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" PagerStyle-AlwaysVisible="true"
AllowCustomPaging="true" PagerStyle-Mode="NextPrevAndNumeric" OnNeedDataSource="dgGroups_NeedDataSource"
PageSize="">
<MasterTableView DataKeyNames="GroupID" ClientDataKeyNames="GroupID">
<Columns>
<telerik:GridBoundColumn HeaderText="用户组名称" DataField="GroupName">
<HeaderStyle Width="200px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="用户组编码" DataField="GroupCode">
<HeaderStyle Width="200px" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn>
<HeaderTemplate>
人员
</HeaderTemplate>
<ItemTemplate>
<a href="#" onclick='openpage(<%#Eval("GroupID") %>)'>点击查看</a>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn>
<HeaderTemplate>
权限
</HeaderTemplate>
<ItemTemplate>
<a href="#" onclick='openwin(<%#Eval("GroupID") %>)'>点击查看</a>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView> </telerik:RadGrid>
<asp:HiddenField ID="hfGroupID" runat="server" />
</form>
</body>
</html>
private Org_UserGroupBLL bll = new Org_UserGroupBLL(); protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["groupName"] = string.Empty;
ViewState["groupCode"] = string.Empty;
} SetPager(this.dgGroups);
} protected void toolBar_ButtonClick(object sender, RadToolBarEventArgs e)
{
this.dgGroups.CurrentPageIndex = ;
ViewState["groupName"] = this.txtGroupName.Text;
ViewState["groupCode"] = this.txtGroupCode.Text;
this.dgGroups.Rebind();
} protected void dgGroups_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
int count = ;
this.dgGroups.DataSource = bll.GetGroups(this.dgGroups.CurrentPageIndex * this.dgGroups.PageSize, this.dgGroups.PageSize, ref count, (string)ViewState["groupName"], (string)ViewState["groupCode"]);
this.dgGroups.VirtualItemCount = count;
this.hfGroupID.Value = string.Empty;
}
后台代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title> <script src="../../../Scripts/jquery.js" type="text/javascript"></script> </head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadGrid AlternatingItemStyle-CssClass="AlterLine" ID="dgRoleUsers" runat="server"
AutoGenerateColumns="false" PageSize="" OnNeedDataSource="dgRoleUsers_NeedDataSource"
AllowPaging="true" AllowMultiRowSelection="true" AllowCustomPaging="true" PagerStyle-AlwaysVisible="true"
PagerStyle-Mode="NextPrevAndNumeric" Width="100%">
<MasterTableView ClientDataKeyNames="RelationID" DataKeyNames="RelationID">
<Columns>
<telerik:GridTemplateColumn HeaderText="部门" ItemStyle-Width="450px">
<ItemTemplate>
<%# GetDeparementFullName(Convert.ToInt32(Eval("UserID"))) %>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="姓名" DataField="UserName">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>
<asp:HiddenField ID="hfRoleID" runat="server" />
</form>
</body>
</html>
列表-前台页面
private Org_Relation_UserToGroupBLL bll = new Org_Relation_UserToGroupBLL(); protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.hfRoleID.Value = Convert.ToInt32(Request.QueryString["GroupID"]).ToString();
} int UserDepID = ;
if (CurrentUser.Project != null)
{
UserDepID = CurrentUser.Project.DepID;
}
else if (CurrentUser.SubCompany != null)
{
UserDepID = CurrentUser.SubCompany.DepID;
}
else
{
UserDepID = ;
} SetPager(this.dgRoleUsers);
}
protected void dgRoleUsers_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
Foe.Common.HelperClass.Pagination pa = new Foe.Common.HelperClass.Pagination();
pa.PageSize = this.dgRoleUsers.PageSize;
pa.PageIndex = dgRoleUsers.CurrentPageIndex + ; Foe.Model.Organization.Org_Relation_UserToGroup model = new Foe.Model.Organization.Org_Relation_UserToGroup();
model.GroupID = Convert.ToInt32(this.hfRoleID.Value); int UserDepID = ; if (CurrentUser.Project != null)
{
UserDepID = CurrentUser.Project.DepID;
}
else if (CurrentUser.SubCompany != null)
{
UserDepID = CurrentUser.SubCompany.DepID;
}
this.dgRoleUsers.DataSource = bll.GetListByPage(model, pa, UserDepID);
this.dgRoleUsers.VirtualItemCount = pa.TotalRecord;
} /// <summary>
/// 初始化用户部门全路径
/// </summary>
public string GetDeparementFullName(int userID)
{
Foe.BLL.Organization.Org Organizationll = new Foe.BLL.Organization.Org(); return Organizationll.GetFullPathByEmpID(userID); }
列表-后台代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title> <script src="../../../Scripts/jquery.js" type="text/javascript"></script> <script src="../../../Scripts/jquery.foe.common.js" type="text/javascript"></script> <script src="../../../Scripts/jquery.foe.utils.js" type="text/javascript"></script> <script type="text/javascript" language="javascript">
$(document).ready(function() {
$('#btnSave').click(function() {
var GroupId = $("#hidGroupId").val();
var check = $("input[type='checkbox']");
check.each(function() {
if ($(this).is(':checked')) {
var flowid = $(this).next('input:hidden[id*=hidID]').val();
if (flowid != "" && flowid != "undefined") {
SaveFlowInfo(GroupId, flowid);
}
else
{ return false; }
}
});
alert('保存成功');
opener.location.reload();
window.close();
});
}); function SaveFlowInfo(GroupId, flowid) {
$.ajax({
type: "post",
url: "Sys_UserGroupPermissionSaveFlowInfo.ashx?GroupId=" + escape(GroupId) + "&&FixedFlowID=" + escape(flowid),
dataType: "json",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
success: function(data) {
if (data != null) {
return true; }
else {
return false;
}
}, error: function(XMLHttpRequest, textStatus, errorThrown) { return false; } }); } </script> </head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<div>
<telerik:RadGrid AlternatingItemStyle-CssClass="AlterLine" ID="dgManage" runat="server"
AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" PagerStyle-AlwaysVisible="true"
AllowMultiRowSelection="true" AllowCustomPaging="true" PagerStyle-Mode="NextPrevAndNumeric"
OnNeedDataSource="dgManage_NeedDataSource" PageSize="">
<MasterTableView DataKeyNames="FixedFlowID,FixedFlowTypeFullName" ClientDataKeyNames="FixedFlowID,FixedFlowTypeFullName">
<Columns>
<%--<telerik:GridClientSelectColumn UniqueName="FixedFlowID" />
--%>
<telerik:GridTemplateColumn HeaderText="选择" ItemStyle-Width="50px" HeaderStyle-Width="50px">
<ItemTemplate>
<input type="checkbox" id="ckhItem" runat="server" />
<asp:HiddenField ID="hidID" runat="server" Value='<%#Eval("FixedFlowID") %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="50px" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="编号" DataField="FixedFlowID" Visible="false"
HeaderStyle-Width="80px" ItemStyle-Width="80px">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="流程名称" DataField="FixdeFlowName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="类别" DataField="FixedFlowTypeFullName">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" />
<Resizing AllowColumnResize="true" ResizeGridOnColumnResize="true" />
</ClientSettings>
<PagerStyle Mode="NextPrevAndNumeric" />
</telerik:RadGrid>
</div>
<div style="margin: 5px auto; width: 100%; text-align: center">
<input type="button" id="btnSave" value="保存" class="btn" /> <input type="button"
value="关闭" class="btn" onclick="window.close()" />
</div>
<asp:HiddenField ID="hidFixedFlowID" runat="server" />
<asp:HiddenField ID="hidGroupId" runat="server" />
</form>
</body>
</html>
新增多项前台页面代码
Foe._2B2C.Model.ModelTempTableFlow mode = new Foe._2B2C.Model.ModelTempTableFlow(); protected void Page_Load(object sender, EventArgs e)
{
this.hidGroupId.Value = Request.QueryString["GroupID"];
if (!IsPostBack)
{
BindDataSource();
}
SetPager(this.dgManage);
} protected void dgManage_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
BindDataSource();
} protected void BindDataSource()
{
var pi = new Foe.Common.HelperClass.Pagination()
{
PageIndex = this.dgManage.CurrentPageIndex +
}; this.dgManage.DataSource = new Foe._2B2C.BLL.BLLTempTableFlow().GetList(mode, pi);
this.dgManage.VirtualItemCount = pi.TotalRecord;
}
新增后台代码
模板列传值到子窗体中,子窗体中多选gridview中checkbox保存数据多项到数据库中的更多相关文章
- 怎样把excel的数据导入到sqlserver2000数据库中
在做程序的时候有时需要把excel数据导入到sqlserver2000中,以前没从外部导入过数据,今天刚做了一下导入数据,感觉还是蛮简单的,没做过之前还想着多么的复杂呢,下面就来分享一下我是如何把ex ...
- python 读取SQLServer数据插入到MongoDB数据库中
# -*- coding: utf-8 -*-import pyodbcimport osimport csvimport pymongofrom pymongo import ASCENDING, ...
- 如何将MongoDB数据库的数据迁移到MySQL数据库中
FAQ v2.0终于上线了,断断续续忙了有2个多月.这个项目是我实践的第一个全栈的项目,从需求(后期有产品经理介入)到架构,再到设计(有征询设计师的意见).构建(前端.后台.数据库.服务器部署),也是 ...
- 利用POI工具读取word文档并将数据存储到sqlserver数据库中
今天实现了利用POI工具读取word文档,并将数据存储到sql数据库中,代码如下: package word; import java.io.File; import java.io.FileInpu ...
- Excel表数据导入Sql Server数据库中
Excel表数据导入Sql Server数据库的方法很多,这里只是介绍了其中一种: 1.首先,我们要先在test数据库中新建一个my_test表,该表具有三个字段tid int类型, tname nv ...
- C#-WinForm-ListView-表格式展示数据、如何将数据库中的数据展示到ListView中、如何对选中的项进行修改
在展示数据库中不知道数量的数据时怎么展示最好呢?--表格 ListView - 表格形式展示数据 ListView 常用属性 HeaderStyle - "详细信息"视图中列标头的 ...
- 快速将excel数据保存到Oracle数据库中【转】
我们在工作中,也许会碰到以下情况,客户或者同事发来需要调查的数据,并不是dmp文件,而是excel文件,此时通常是一张表,少量几条记录.最近我恰好碰到了这种情况,所以做了些调查,不敢藏私,拿出来跟大家 ...
- 用JDBC把Excel中的数据导入到Mysql数据库中
步骤:0.在Mysql数据库中先建好table 1.从Excel表格读数据 2.用JDBC连接Mysql数据库 3.把读出的数据导入到Mysql数据库的相应表中 其中,步骤0的table我是先在Mys ...
- logstash将redis中的队列中数据发送到influxdb数据库中
通过elk获取到的java jvm中ygc的时间如下: 现在讲ygc字段的值,发送到influxdb中 首先安装logstash的插件 logstash-output-influxdb 安装完成后,查 ...
随机推荐
- 研究分布式唯一ID生成,看完这篇就够
很多大的互联网公司数据量很大,都采用分库分表,那么分库后就需要统一的唯一ID进行存储.这个ID可以是数字递增的,也可以是UUID类型的. 如果是递增的话,那么拆分了数据库后,可以按照id的hash,均 ...
- UPC Contest RankList – 2019年第二阶段我要变强个人训练赛第十五场
传送门 A: Colorful Subsequence •题意 给一个长为n的小写字母序列,从中选出字母组成子序列 问最多能组成多少种每个字母都不相同的子序列 (不同位置的相同字母也算是不同的一种) ...
- spring中获取容器中的Bean为什么前转成接口而不是实现类
简单介绍一下上下文,userService是服务层接口有一个save方法,userServiceImpl是该接口的实现类重写了save方法. applicationContext.xml如图: 后台代 ...
- ubuntu防火墙规则之ufw
前言 因公司项目的需求,需要对客户端机器简便使用防火墙的功能,所以可在页面进行简便设置防护墙规则,当然,这个功能需求放到我手上我才有机会学到.因为客户端机器都是ubuntu的,所以当然用了ubuntu ...
- python多进程详解
目录 python多进程 序.multiprocessing 一.Process process介绍 例1.1:创建函数并将其作为单个进程 例1.2:创建函数并将其作为多个进程 例1.3:将进程定义为 ...
- 控制台出现_ob_:Obsever
我遇到一个问题:我的代码想让他点击之后得到经纬度坐标数组,然后我就这样写了 然而控制台却读取出了
- Android使用xUtils3上传图片报错解决:java.lang.ArrayIndexOutOfBoundsException: 70918
今天在使用安卓xUtils3框架配合SmartUpload框架上传图片到Java服务端时,遇到了一个莫名其妙的错误: 安卓端代码如下: 似乎并没有发现什么问题,以前在用xUtils2.6老版本时也是这 ...
- gRPC的简单使用
目录 前言 gRPC的简单介绍 基本用法 服务的定义 服务端代码编写 客户端代码编写 运行效果 服务治理(注册与发现) .NET Core 2.x 和 .NET Core 3.0的细微区别 扩展阅读 ...
- Go中的文件读写
在 Go 语言中,文件使用指向 os.File 类型的指针来表示的,也叫做文件句柄 .我们来看一下os包的使用方式. 1.读取文件 os包提供了两种打开文件的方法: Open(name string) ...
- Linux常用命令之ftp
FTP是Internet用户使用最频繁的文件上传.下载的命令之一.linux ftp用命令的方式来控制在本机和远程ftp服务器之间传送文件.ftp中的命令包括上传文件(单个.多个),下载文件(单个.多 ...