ASPxGridView1用法-
后台帮定代码:
using System;
using System.Collections.Generic;
using System.Linq;using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class Default2 : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e) { Datagrid(); } private void Datagrid() { DataTable data = DB.FillDataTable_Pro("select top 40 * from bi_t_item_info"); this.ASPxGridView1.DataSource = data; this.ASPxGridView1.DataBind(); }
//***事件
protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) DB.ExecuteScalar(string.Format("delete bi_t_item_info where item_no='{0}'", str)); e.Cancel = true; Datagrid(); } }
前台代码:
<dx:ASPxGridView ID="ASPxGridView1" runat="server" OnRowDeleting="ASPxGridView1_RowDeleting"OnDataBound="ASPxGridView1_DataBound"
KeyFieldName="item_no"
><Columns><dx:GridViewCommandColumn VisibleIndex="0" ShowSelectCheckbox="True"><EditButton Visible="True" Text="编辑"></EditButton><DeleteButton Visible="True" Text="***"></DeleteButton></dx:GridViewCommandColumn><dx:GridViewDataTextColumn Caption="编号" FieldName="item_no" Name="item_no" VisibleIndex="0"ReadOnly="true"></dx:GridViewDataTextColumn><dx:GridViewDataTextColumn Caption="条码" FieldName="barcode" Name="barcode" VisibleIndex="1"ReadOnly="true"></dx:GridViewDataTextColumn><dx:GridViewDataTextColumn Caption="单位" FieldName="unit_no" Name="unit_no" VisibleIndex="2"ReadOnly="true"></dx:GridViewDataTextColumn><dx:GridViewDataTextColumn Caption="名称" FieldName="item_name" Name="item_name" VisibleIndex="3"ReadOnly="false"></dx:GridViewDataTextColumn><dx:GridViewDataTextColumn Caption="零售价" FieldName="sale_price" Name="sale_price"VisibleIndex="4" ReadOnly="false"></dx:GridViewDataTextColumn><dx:GridViewDataTextColumn Caption="备注" FieldName="item_other3" Name="sale_price"VisibleIndex="4" ReadOnly="false"></dx:GridViewDataTextColumn></Columns><SettingsBehavior AllowSelectByRowClick="True" ConfirmDelete="True" /></dx:ASPxGridView>
要注意的是,有红色标示地方,此处必须是主键,我就是因为这个地方没有邦定主键,***事件不执行,查了好久才查出来!
对于ASPxGridView***按钮的确认弹出框,只需要简单设置几个属性即可。
1.首先自然要先启用行的***功能。
2.然后设置ASPxGridView的SettingsBehavior的ConfirmDelete属性为Ture,即启用***功能的确认框。
3.设置弹出框内容文本。在ASPxGridView的SettingsText中设置ConfirmDelete属性为”确定要***吗?”即可。
几个常用属性
IsEditing : 是否处于编辑状态
IsNewRowEditing : 是否是新建行的编辑状态
GridLines="Vertical" : 网格样式 Vertical, Both, None
ShowGroupPanel="True" : 分组面板
ShowFooter="True" : 脚注面板
ShowFilterRow="True" : 过滤器行
ShowHeaderFilterButton="true" : 表头过滤按钮
ShowGroupFooter="VisibleAlways" : 分组脚注面板 Hidden | VisibleIfExpand | VisibleAlways
ShowPreview="true" : 预览面板
ShowVerticalScrollBar="True" : 垂直滚动条
VerticalScrollableHeight="250" : 垂直滚动条
SettingsBehavior
AllowDragDrop="False" : 允许托拽
ColumnResizeMode="Control" : 列宽度调整模式
AllowFocusedRow="True" : 鼠标点击选择行
PageSize="30" : 分页大小
Mode="ShowAllRecords" : 展示模式
SEOFriendly="Enabled" : Search engine friendly
Position="TopAndBottom" : 分页控件位置
SettingsText
Title="标题"
EmptyDataRow="无数据"
PopupEditFormCaption="编辑"
ConfirmDelete="确定***?"
编辑模式 SettingsEditing.Mode
EditForm : 当前行转化为表单,嵌入在行中
EditFormAndDisplayRow : 同EditForm,但保留当前行
Inline : 在当前行现场编辑
PopupEditForm : 弹出窗口编辑
几个常用方法
获取单元格的值
decimal change = (decimal)grid.GetRowValues(e.VisibleIndex, "Change");
获取模板中的控件
Label label = grid.FindRowCellTemplateControl(e.VisibleIndex, null, "changePercent") as Label;
转载于:https://blog.51cto.com/317057112/741433
ASPxGridView1用法-相关推荐
- Dev控件用法 aspxTreeList 无刷新 aspxGridView 数据
Dev控件用法 aspxTreeList 无刷新 aspxGridView 数据 主要是利用 ASPxTreeList 点击事件回发服务器进行数据重新绑定 ASPxTreeList: ? 1 2 &l ...
- c语言中external,static关键字用法
static用法: 在C中,static主要定义全局静态变量.定义局部静态变量.定义静态函数. 1.定义全局静态变量:在全局变量前面加上关键字static,该全局变量变成了全局静态变量.全局静态变量有 ...
- Pandas_transform的用法
先来看一个实例问题. 如下销售数据中展现了三笔订单,每笔订单买了多种商品,求每种商品销售额占该笔订单总金额的比例.例如第一条数据的最终结果为:235.83 / (235.83+232.32+107.9 ...
- Python中yield和yield from的用法
yield 后面接的是 future 对象 调用方 委托生成器 yield from 直接给出循环后的结果 yield from 委托者和子生成器直接通信 yield from 直接处理stopIte ...
- pytorch学习 中 torch.squeeze() 和torch.unsqueeze()的用法
squeeze的用法主要就是对数据的维度进行压缩或者解压. 先看torch.squeeze() 这个函数主要对数据的维度进行压缩,去掉维数为1的的维度,比如是一行或者一列这种,一个一行三列(1,3)的 ...
- python yield 和 yield from用法总结
#例1. 简单输出斐波那契數列前 N 个数 #缺点:该函数可复用性较差,因为 fab 函数返回 None,其他函数无法获得该函数生成的数列 #要提高 fab 函数的可复用性,最好不要直接打印出数列,而 ...
- tf.nn.embedding_lookup()的用法
函数: tf.nn.embedding_lookup( params, ids, partition_strategy='mod', name=None, validate_indices=True, ...
- OpenMP用法大全
OpenMP基本概念 OpenMP是一种用于共享内存并行系统的多线程程序设计方案,支持的编程语言包括C.C++和Fortran.OpenMP提供了对并行算法的高层抽象描述,特别适合在多核CPU机器上的 ...
- Dorado用法与示例
Dorado用法与示例 dorado用后总结 一.dorado概念 dorado的产品全名是"dorado展现中间件".从产品形态上dorado由两部分组成,第一部分是一个具有AJ ...
最新文章
- main函数的参数详解,它们是何时何处传入的?(main函数的参数值是从操作系统命令行上获得的)
- 解决 Mysql下使用EF Code First 指定表Engine无效的思路
- [转].NET 数据库连接池
- Nessus扫描器的使用
- 【性能优化】 之性能视图及性能参数
- XCode 6 制作framework
- PyTorch框架学习十五——可视化工具TensorBoard
- 【JAVA基础篇】IO流
- Python下socket通信
- 按键映射_通J1手游按键开箱——这可能是最小的游戏外设了
- paip.提升用户体验---c++ gcc 命令语法着色搭配方案
- 使用ExtJS创建前端WebQQ界面
- 老师用计算机教我们画画拼音,《ang eng ing ong》教案
- 一个提供用emai订阅rss的中文网站
- 非淡泊无以明志,非宁静无以致远。
- OpenLayers禁用鼠标双击放大事件
- nginx关闭请求处理ngx_http_finalize_request源码分析
- 基于STC89C52单片机实现简易计算器
- clickhouse--求累计数值
- 学 Win32 汇编[24] - 移位: SHL、SHR、SAL、SAR、ROL、ROR、RCL、RCR、SHLD、SHRD
热门文章
- html加了文档声明之后页面错乱,为登陆页面扩展和配置设计导入程序
- 计算机桌面底部不显示了,为什么电脑底部不会显示出来怎么办
- mysql模糊查询索引失效_MySql学习笔记(九):索引失效
- 如何清空_回收站删除的文件怎么恢复?回收站清空如何恢复?
- 根据流程部署ID来获取流程定义图片
- python列表中删除子列表_从列表列表中删除列表元素
- python全屏模式 spider_我可以使用PIL以全屏模式显示图像吗?
- android随机数方法,Android生成随机数的方法实例
- python绑定句柄容易么_Python 有什么奇技淫巧?
- go build 无文件_Go学习_30_Golang代码性能分析工具