aspxgridview只编辑某一列然后更新


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="IsAllowDelivery.aspx.cs" Inherits="ERP.Web.Finance.Agent.IsAllowDelivery" %> <%@ Register assembly="DevExpress.Web.v12.2, Version=12.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Data.Linq" tagprefix="dx" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script type="text/javascript"> </script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div> <dx:ASPxButton ID="ASPxButton1" runat="server" OnClick="ASPxButton1_Click" Text="保存">
</dx:ASPxButton> </div>
<div>
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" ClientInstanceName="grid1" DataSourceID="SqlDataSource1" KeyFieldName="代码" Width="266px" OnRowUpdating="ASPxGridView1_RowUpdating">
<clientsideevents rowclick="function(s, e) {
grid1.StartEditRow(e.visibleIndex);
}" />
<Columns>
<dx:GridViewDataTextColumn FieldName="代码" ReadOnly="True" VisibleIndex="0" Width="80px">
<editcellstyle horizontalalign="Center">
</editcellstyle>
<DataItemTemplate>
<asp:Label id="Label4" runat="server" Text='<%# Eval("代码") %>' Width="50px" />
</DataItemTemplate>
<EditItemTemplate>
<asp:Label id="Label1" runat="server" Text='<%# Eval("代码") %>' Width="50px" />
</EditItemTemplate>
<cellstyle horizontalalign="Center">
</cellstyle>
</dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName="名称" ReadOnly="True" VisibleIndex="1" Width="80px">
<editcellstyle horizontalalign="Center">
</editcellstyle>
<DataItemTemplate>
<asp:Label id="Label2" runat="server" Text='<%# Eval("名称") %>' />
</DataItemTemplate>
<EditItemTemplate>
<asp:Label id="Label3" runat="server" Text='<%# Eval("名称") %>' />
</EditItemTemplate>
<cellstyle horizontalalign="Center">
</cellstyle>
</dx:GridViewDataTextColumn>
<dx:GridViewDataCheckColumn FieldName="是否允许发货" VisibleIndex="2" Width="50px">
<editcellstyle horizontalalign="Center" verticalalign="Middle" wrap="True">
</editcellstyle>
<editformcaptionstyle horizontalalign="Center">
</editformcaptionstyle>
<EditItemTemplate>
<dx:ASPxCheckBox ID="edits" runat="server" ClientInstanceName="edit" Checked='<%# Eval("是否允许发货") %>' >
<clientsideevents checkedchanged="function(s, e) {
grid1.UpdateEdit();
}" /> /dx:ASPxCheckBox>
</EditItemTemplate> <cellstyle horizontalalign="Center" verticalalign="Middle" wrap="True">
</cellstyle>
</dx:GridViewDataCheckColumn>
</Columns>
<settingsbehavior allowselectbyrowclick="True" />
<settingspager pagesize="20">
</settingspager>
<settingsediting mode="Inline" />
</dx:ASPxGridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:cobosdConnectionString %>" DeleteCommand="DELETE FROM [xs_办事处档案] WHERE [代码] = @original_代码" InsertCommand="INSERT INTO [xs_办事处档案] ([代码], [名称], [是否允许发货]) VALUES (@代码, @名称, @是否允许发货)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [代码], [名称], [是否允许发货] FROM [xs_办事处档案]" UpdateCommand="UPDATE [xs_办事处档案] SET [名称] = @名称, [是否允许发货] = @是否允许发货 WHERE [代码] = @original_代码">
<DeleteParameters>
<asp:Parameter Name="original_代码" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="代码" Type="String" />
<asp:Parameter Name="名称" Type="String" />
<asp:Parameter Name="是否允许发货" Type="Boolean" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="名称" Type="String" />
<asp:Parameter Name="是否允许发货" Type="Boolean" />
<asp:Parameter Name="original_代码" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; using DevExpress.Web.ASPxEditors;
using DevExpress.Web.ASPxGridView;
namespace ERP.Web.Finance.Agent
{
public partial class IsAllowDelivery : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ } protected void ASPxButton1_Click(object sender, EventArgs e)
{
ASPxGridView1.UpdateEdit();
} protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{ ASPxGridView1.UpdateEdit();
} protected void edit_CheckedChanged(object sender, EventArgs e)
{ } protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
{ ASPxCheckBox ck = (ASPxCheckBox)ASPxGridView1.FindEditRowCellTemplateControl((GridViewDataColumn)ASPxGridView1.Columns["是否允许发货"], "edits");
e.NewValues["是否允许发货"] = ck.Checked;
}
}
}
aspxgridview只编辑某一列然后更新的更多相关文章
- Extjs之rowEditing编辑状态时列不对齐
Extjs在使用rowEditing的时候,会在每一列加上editor属性,表示当处于编辑状态时这一列的值是什么类型的,后突然发现在rowEditing处于编辑状态时每一列的宽度边框了,如果列数非常多 ...
- SQLServer数据库自增长标识列的更新修改操作
SQLServer数据库自增长标识列的更新修改操作方法在日常的sql server开发中,经常会用到Identity类型的标识列作为一个表结构的自增长编号.比如文章编号.记录序号等等.自增长的标识列的 ...
- sqlalchemy如何实现时间列自动更新?
目标:数据表的时间列在其他列内容更新的时候,自动更新时间列到更新的时间 方法:数据库表模型如下:server_default表示初始时间,onupdate表示更新的时间 class MonitorDa ...
- MFC编辑框接收数据动态更新与刷新方法代码示例-如何让编辑框内容实时更新
MFC编辑框接收数据动态更新与刷新方法代码示例-如何让编辑框内容实时更新 关键代码: //发送数据通知 //from txwtech@163.com LRESULT CCommSampleDlg::O ...
- 使用Vue-TreeSelect组件的时候,用watch变量方式解决弹出编辑对话框界面无法触发更新的问题
在前篇随笔<使用Vue-TreeSelect组件实现公司-部门-人员级联下拉列表的处理>中介绍了Vue-TreeSelect组件的使用,包括使用v-modal绑定值,normalizer ...
- EasyUI/TopJUI可编辑表格的列根据返回数据判断是使用 combobox 还是 numberbox
这两天研究了一下topjui的可编辑表格edatagrid,想在每一列的后面根据返回的数据判断是使用 combobox 还是 numberbox,期间遇到了一些坑,下面实现代码,需要的朋友可以参考一下 ...
- [Oracle] 生产上表的列类型更新
由于粗心,数据库脚本生成的时候错将一个类型NUMBER(5)的字段类型改为 VARCHAR2(5) 直接进行表修改会报错,因为数据已经存在,不能进行更新: ); 大体思路如下: 将要更改类 ...
- SQL语句的Select部分只写必要的列
如果Select部分包含不需要的列,这会强制DB2必须进入数据页来得到所请求的特定列,这就要求更多的I/O操作.另外,如果再对这个不需要的列进行排序,就需要创建和传递一个更大的排序文件,相应地会使排序 ...
- Pandas(python)数据处理:只对某一列DataFrame数据进行归一化
处理数据要用到Pandas,但是没有学过,不知道是否有直接对某一列归一化的方法调用.自己倒弄了下.感觉还是比较麻烦. 使用Pandas读取到数组之后想把其中的'MonthlyIncome'一列进行归一 ...
随机推荐
- P1807 最长路_NOI导刊2010提高(07)
题目描述 设G为有n个顶点的有向无环图,G中各顶点的编号为1到n,且当为G中的一条边时有i < j.设w(i,j)为边的长度,请设计算法,计算图G中<1,n>间的最长路径. 输入输出 ...
- bzoj 3217: ALOEXT
将此神题作为博客园的第一篇文章,至此,数据结构基本学完了(或者说数据结构轮流虐了我一次!) 人生第一道7K代码题! 没什么,就是treap套个trie,然后tle是因为一定要用指针当时p党谁会用那么丑 ...
- BZOJ3236:[AHOI2013]作业——题解
https://www.lydsy.com/JudgeOnline/problem.php?id=3236 第一种做法: 建两棵主席树分别处理两个问题. 第一个问题水,第二个问题参考SPOJ3267/ ...
- BZOJ2120:数颜色——题解
https://www.lydsy.com/JudgeOnline/problem.php?id=2120 https://www.luogu.org/problemnew/show/P1903#su ...
- BZOJ4869:[SHOI2017]相逢是问候——题解
http://www.lydsy.com/JudgeOnline/problem.php?id=4869 题面复制于洛谷:https://www.luogu.org/problemnew/show/P ...
- HDOJ.1257 最少拦截系统 (贪心)
最少拦截系统 点我挑战题目 题意分析 一开始理解错了这道题.这么多个导弹排好序不只需要1个拦截系统吗.后来发现自己真傻.那出这个题还有啥意思,反正都需要一个.(:′⌒`) 给出n个导弹,这n个导弹的顺 ...
- Vue项目搭建过程
环境搭建:mac+nodejs+npm #安装node.js : $ brew install node #安装vue-cil: $ npm install -g vue-cli 注:官网下载安装no ...
- ipython 安装和更新
pip install ipython pip install --upgrade ipython pip install --upgrade pip 不管是用pip装什么模块,前面都尽量不要加sud ...
- 【图像处理】Haar Adaboost 检测自定义目标(视频车辆检测算法代码)
阅读须知 本博客涉及到的资源: 正样本:http://download.csdn.net/detail/zhuangxiaobin/7326197 负样本:http://download.csdn.n ...
- pushViewController:animated:的问题
1.在AppDelegate.m中: 2.在SecondViewController.h中: 3.在FirstViewController.m中: 4.在SecondViewController.m中 ...