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'一列进行归一 ...
随机推荐
- [HNOI2010] 弹飞绵羊 (分块)
[HNOI2010] 弹飞绵羊 题目描述 某天,Lostmonkey发明了一种超级弹力装置,为了在他的绵羊朋友面前显摆,他邀请小绵羊一起玩个游戏.游戏一开始,Lostmonkey在地上沿着一条直线摆上 ...
- java重写equals和hashCode方法
一.重写equals方法 如果不重写equals,那么比较的将是对象的引用是否指向同一块内存地址,重写之后目的是为了比较两个对象的value值是否相等. 利用equals比较八大包装对象(如int,f ...
- Android核心类源码分析
Handler流程1.首先Looper.prepare()在本线程中保存一个Looper实例,然后该实例中保存一个MessageQueue对象:因为Looper.prepare()在一个线程中只能调用 ...
- c# txt 文件上传、写入TXT文件、创建图形验证码
asp.net mvc 图片上传 html 在使用包含文件上传控件的表单时,必须使用 enctype="multipart/form-data" 属性 <form encty ...
- 替换Jar包中的一个文件 Replace a file in a JAR
例如: jar uf myJarFile.jar com\vsoft\servlet\myServlet.class This will replace the class myServlet.cla ...
- Linux之防火墙与端口
1.关闭所有的 INPUT FORWARD OUTPUT 只对某些端口开放.下面是命令实现: iptables -P INPUT DROPiptables -P FORWARD DROPiptable ...
- python测试rabbitmq简易实例
生产者 import pika #coding=utf8 credentials = pika.PlainCredentials('guest', '密码') connection = pika.Bl ...
- free命令buff和cache的区别
[root@iz8vb8kca7twx6177bqg0fz ~]# free -h total used free shared b ...
- 【Luogu】P3930 SAC E#1 - 一道大水题 Knight
[题目]洛谷10月月赛R1 提高组 [题意]给定n*n棋盘和<=16个棋子,给几个棋子种类和攻击范围,现我方只有一马,求能否吃王. [算法]状压+BFS [题解]16种棋子中,马不能吃马,直接处 ...
- 【BZOJ】3971 [WF2013]Матрёшка
[算法]区间DP [题解] 参考写法:BZOJ 3971 Матрёшка 解题报告 第二个DP可以预处理mex优化到O(nM+n2),不过我懒…… 第一个DP有另一种写法:不预处理,在一个n2取出来 ...