模板列传值到子窗体中,子窗体中多选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 安装完成后,查 ...
随机推荐
- Python实现ParseDuration-支持解析字符串格式的时间单位,例如将小时或者分钟数转换为秒
python的time模块不支持单独将字符串格式的分钟数和小时数转换为秒,比如将“5m”转换为“300”(秒),不支持将“0.2h5.1m12.123s”转换为“1038.123”(秒). 但是这种字 ...
- Drools规则引擎-如果判断某个对象中的集合是否包含指定的值
规则引擎集合相关处理 在实际生产过程中,有很多关于集合的处理场景,比如一个Fact对象中包含有一个集合,而需要判断该集合是否包含某个值.而Drools规则引擎也提供了多种处理方式,比如通过from.c ...
- 【Intellij】Hot Swap Failed & class reloaded
用 Intellij IDEA 编译程序时遇到了这个问题,如下图所示: 对结果貌似没什么影响,但暂时没找到出现这个情况的原因……
- Jquery事件和选择器 纠错
1: 试题分析:该题考的是jQuery中事件绑定的知识.绑定事件用bind()方法,选项A是正确的绑定事件语法,因此是正确的答案.选项BCD的语法是错误的. 2: 试题分析:opacity 必需.规定 ...
- CEPH RGW多 ZONE的配置
相关的名称解释 Region :可以理解为区域,是基于地理位置的逻辑划分:如:华南,华北之类,包含多个region的Ceph集群必须指定一个master region,一个region可以包含一个或者 ...
- Docker笔记(七):常用服务安装——Nginx、MySql、Redis
开发中经常需要安装一些常用的服务软件,如Nginx.MySql.Redis等,如果按照普通的安装方法,一般都相对比较繁琐 —— 要经过下载软件或源码包,编译安装,配置,启动等步骤,使用 Docker ...
- 总结Idea环境,吐血踩过的坑
1)首先是JDK环境安装,这一步千万要出错,我就是配错了CLASSPATH导致了很诡异的问题.可能结果:就是RUN到tomcat不报错,但是有404错误. 2)然后是IDEA安装,这里要十分注意如果你 ...
- 基于RobotFramework实现自动化测试
Java + robotframework + seleniumlibrary 使用Robot Framework Maven Plugin(http://robotframework.org/Mav ...
- alluxio源码解析-层次化存储(4)
层次化存储-特性介绍: https://www.alluxio.org/docs/1.6/cn/Tiered-Storage-on-Alluxio.html 引入分层存储后,Alluxio管理的数据块 ...
- Java虚拟机(一)-Java内存区域
通过看深入理解java虚拟机这本书,大致总结一些笔记,或者提出一些问题,希望大家深入交流学习,第一次写博客,大家多多支持 Java虚拟机对于很多Java开发人员每天都在用,但是大部分人初学者对这些并不 ...