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'一列进行归一 ...
随机推荐
- P3986 斐波那契数列
题目描述 定义一个数列: f(0)=a,f(1)=b,f(n)=f(n−1)+f(n−2) 其中 a,b均为正整数,n≥2 . 问有多少种 (a,b),使得 k 出现在这个数列里,且不是前两项. 由于 ...
- codevs5037 线段树练习4加强版(暴力分块)
求大爷教线段树怎么写啊QAQ 只会写分块...一开始脑抽写成了O(NKlogN)还被CZL大爷嘲讽了一发T T f[i][j]表示在第i块中,模k为j的数有几个,然后每次修改的时候只需要打个标记,查询 ...
- Java Web用Freemarker生成带图片的Word文档
步骤一:模板制作 用world2003做一个导出模板,如果有图片则加入一张图片占位,将world另存为xml,将xml中需要导出的内容用Freemarker标签表示,最后另存为.ftl结尾的模板: 步 ...
- ACM1004 Let the balloons fly
These code is for the problem "Let the balloons Fly" in ACM 1004 which need deal with stri ...
- matlab向量的排序(自写函数)
function a_ed = arraysort(a) %冒泡排序法 for i =1:length(a)-1 %进行多少次比较 for j=1+i:length(a) %每次求出最大的数,放在最后 ...
- ES6 利用集合Set解决数组 交集 并集 差集的问题
根据阮一峰老师的ES6教程自己体会而写的,希望能给一些朋友有帮助到 let a = new Set([1,2,3,4]) let b = new Set([2,3,4,5,]) 并集 let unio ...
- aio 爬虫,去重,入库
#aio 爬虫,去重,入库 import asyncio import aiohttp import aiomysql import re from pyquery import PyQuery st ...
- Ubuntu 15.04 安装配置Apache和mysql的方法
前 言 上篇海面特效的博文结尾提到了SideFX开发的HQueue分布式集群,配置HQueue首先需要安装mysql,所以今天先分享一下如何在Ubuntu系统中安装mysql和Apache: Ubun ...
- Java堆内存Heap与非堆内存Non-Heap
堆(Heap)和非堆(Non-heap)内存 按照官方的说法:“Java 虚拟机具有一个堆,堆是运行时数据区域,所有类实例和数组的内存均从此处分配.堆是在 Java 虚拟机启动时创建的.”“在 ...
- modelsim10 SE 仿真lattice Xp2工程
1.首先要建立Lattice XP2库 在modelsim10 SE启动后.首先指定Lattice Diamond 1.4 给定的仿真器库源代码编译目录: C:\lscc\diamond\1.4\ca ...