AspxGridView整理文档【转】
ASPxGridView属性:概述设置(Settings)
<Settings
GridLines="Vertical" : 网格样式 Vertical, Both, None
ShowGroupPanel="True" : 分组面板
ShowFooter="True" : 脚注面板
ShowFilterRow="True" : 过滤器行
ShowHeaderFilterButton="true" : 表头过滤按钮
ShowFilterBar :允许显示过滤工具条
ShowGroupFooter="VisibleAlways" : 分组脚注面板 Hidden | VisibleIfExpand | VisibleAlways
ShowPreview="true" : 预览面板
ShowVerticalScrollBar="True" : 垂直滚动条
VerticalScrollableHeight="" : 垂直滚动条
/>
行为设置(SettingsBehavior)
<SettingsBehavior
AllowDragDrop="False" : 允许托拽
ColumnResizeMode="Control" : 列宽度调整模式
AllowFocusedRow="True" : 鼠标点击选择行
AllowSort :允许排序
AllowGroup :允许分组
autoExpandAllGroups :自动展开所有组
ConfirmDelete :允许提交删除
AllowMultiSelection :允许选择多行
/>
分页(SettingsPager)
<SettingsPager
PageSize="" : 分页大小
Mode="ShowAllRecords" : 展示模式
SEOFriendly="Enabled" : Search engine friendly
Position="TopAndBottom" : 分页控件位置
>
<Summary AllPagesText="页: {0} / {1} ({2}行)" />
</SettingsPager>
文本设置(SettingsText)
<SettingsText
Title="标题"
EmptyDataRow="无数据"
PopupEditFormCaption="编辑"
ConfirmDelete="确定删除?"
/>
Loading 面板设置(SettingsLoadingPanel)
<SettingsLoadingPanel Mode="ShowOnStatusBar" /> 编辑视图设置(SettingsEditing)
<SettingsEditing
PopupEditFormWidth = "600px"
NewItemRowPosition = "Bottom"
Mode = "PopupEditForm"
/>
编辑模式 SettingsEditing.Mode
EditForm : 当前行转化为表单,嵌入在行中
EditFormAndDisplayRow : 同EditForm,但保留当前行
Inline : 在当前行现场编辑
PopupEditForm : 弹出窗口编辑
行详细设置(SettingDetail)
<SettingDetail
AllowOnlyOneMasterRowExpanded :允许只展开一列详细信息
ShowDetailRow :允许显示详细列表
IsDetailGrid :允许显示分组
>
动态选中某一行:
AspxgridView1.Selection.SetSelection(i.true)
遍历所有行:
声明变量:DataRowView dv
For(int i=;i< AspxgridView1.VisbleRowCount;i++)
{
选中行提取数据:if(AspxgridView1.Selection.IsRowSelected(i))
{
行数据集 dv=(DataRowView)AspxgridView1.GetRow(i);
}
} ASPxGridView 样式 & 格式
---------------------------------------------------------
集中式样式
<Styles>
<Header HorizontalAlign="Center" /> : 标题居中对齐
<AlternatingRow Enabled="true"/> : 交错行效果
<CommandColumn Paddings-Padding="" /> :
</Styles>
列样式
<dxwgv:GridViewDataTextColumn FieldName="Total" UnboundType="Decimal">
<FooterCellStyle ForeColor="Brown"/>
</dxwgv:GridViewDataTextColumn>
数字日期格式
金额
<dxwgv:GridViewDataTextColumn FieldName="UnitPrice" >
<PropertiesTextEdit DisplayFormatString="c" />
</dxwgv:GridViewDataTextColumn>
时间
<dxwgv:GridViewDataDateColumn Caption="Time" FieldName="Time">
<PropertiesDateEdit DisplayFormatString="HH:mm:ss" />
<CellStyle HorizontalAlign="Right" />
</dxwgv:GridViewDataDateColumn>
图像
<Images ImageFolder="~/App_Themes/Glass/{0}/">
<CollapsedButton Height="12px" Width="11px" />
<DetailCollapsedButton Height="9px" Width="9px" />
<PopupEditFormWindowClose Height="17px" Width="17px" />
</Images> ASPxGridView分组 & 汇总 & 排序
---------------------------------------------------------
间隔分组:将时间日期字段按个性分组,如年、月、日、周、季度、上周、下周.....
<dxwgv:GridViewDataDateColumn FieldName="OrderDate" VisibleIndex="" GroupIndex="">
<Settings GroupInterval="DateYear"/>
</dxwgv:GridViewDataDateColumn>
汇总
<TotalSummary>
<dxwgv:ASPxSummaryItem FieldName="CompanyName" SummaryType="Count"/>
<dxwgv:ASPxSummaryItem FieldName="Total" SummaryType="Sum" DisplayFormat="c"/>
<dxwgv:ASPxSummaryItem FieldName="Quantity" SummaryType="Min" />
<dxwgv:ASPxSummaryItem FieldName="Quantity" SummaryType="Average" />
<dxwgv:ASPxSummaryItem FieldName="Quantity" SummaryType="Max" />
</TotalSummary> 分组汇总
<GroupSummary>
<dxwgv:ASPxSummaryItem FieldName="Country" SummaryType="Count" />
<dxwgv:ASPxSummaryItem FieldName="Quantity" SummaryType="Sum" />
<dxwgv:ASPxSummaryItem FieldName="Total" SummaryType="Sum" DisplayFormat="{0:c}"/>
</GroupSummary> ASPxGridView 列:
---------------------------------------------------------
基本列(GridViewDataColumn)
<dxwgv:GridViewDataColumn FieldName="Country" VisibleIndex="" />
其他列
<dx:GridViewDataTextColumn /> : 文本列
<dx:GridViewDataMemoColumn /> : 长文本列
<dx:GridViewDataImageColumn /> : 图像列
<dx:GridViewDataBinaryImageColumn /> : 二进制图像列
<dx:GridViewDataDateColumn /> : 日期列
<dx:GridViewDataTimeEditColumn /> : 时间列
<dx:GridViewDataComboBoxColumn /> : 组合框列
<dx:GridViewDataDropDownEditColumn /> : 下拉框编辑列?
<dx:GridViewCommandColumn /> : 命令按钮列
<dx:GridViewDataButtonEditColumn /> : 编辑按钮列?
<dx:GridViewDataCheckColumn /> : 复选框列
<dx:GridViewDataColorEditColumn /> : 色彩列
<dx:GridViewDataHyperLinkColumn /> : 超链接列
<dx:GridViewDataProgressBarColumn /> : 进度条列
<dx:GridViewDataSpinEditColumn /> : SpinEdit列 长文本列(GridViewDataMemoColumn)
编辑时展现为多行文本框
<dx:GridViewDataMemoColumn FieldName="Remarks" Caption="备注"
EditCellStyle-BackColor="Yellow" // 行的背景颜色
PropertiesMemoEdit-Rows="" // 添加或是修改时 跨行
EditFormSettings-ColumnSpan="" //添加或是修改时 跨列
/>
超链接列(GridViewDataHyperLinkColumn)
<dx:GridViewDataHyperLinkColumn FieldName="ArticleId" Caption="查看" >
<PropertiesHyperLinkEdit Text="查看" TextFormatString="" />
</dx:GridViewDataHyperLinkColumn>
组合框列(GridViewDataComboBoxColumn)
<dx:ASPxGridView OnCellEditorInitialize="grid_CellEditorInitialize">
<dxwgv:GridViewDataComboBoxColumn FieldName="City" VisibleIndex="">
<PropertiesComboBox EnableSynchronization="False" EnableIncrementalFiltering="True" DropDownStyle="DropDown" />
</dxwgv:GridViewDataComboBoxColumn>
</dx:ASPxGridView>
protected void grid_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
{
// 用下拉框展示国家下的所有城市 绑定数据源
if(grid.IsEditing && e.Column.FieldName != "City" && !grid.IsNewRowEditing)
{
ASPxComboBox combo = e.Editor as ASPxComboBox;
string country = (string)grid.GetRowValuesByKeyValue(e.KeyValue, "Country");
FillCityCombo(combo, country);
}
}
命令按钮列(GridViewCommandColumn) <dx:ASPxGridView runat="server" KeyFieldName="ID"
OnRowDeleting="gv_RowDeleting" OnRowUpdating="gv_RowUpdating" OnRowInserting="gv_RowInserting" <Columns> 一种是添加图片的 <dx:GridViewCommandColumn VisibleIndex="" ButtonType="Image" Caption=操作">
<EditButton Visible="True">
<Image ToolTip="修改" Url="Images/edit.png" />
</EditButton>
<NewButton Visible="True">
<Image ToolTip="新建" Url="Images/new.png" />
</NewButton>
<DeleteButton Visible="true">
<Image ToolTip="删除" Url="Images/del.png" />
</DeleteButton>
<CancelButton Visible="True">
<Image ToolTip="关闭" Url="Images/cancel.png" />
</CancelButton>
<UpdateButton Visible="True">
<Image ToolTip="保存" Url="Images/update.png" />
</UpdateButton>
<ClearFilterButton Visible="true">
<Image ToolTip="清空" Url="Images/del2.png" />
</ClearFilterButton> <HeaderStyle HorizontalAlign="Center" />
</dx:GridViewCommandColumn>
一种就只这种标准的: <dxwgv:GridViewCommandColumn>
<EditButton Visible="True" Text="修改" />
<DeleteButton Visible="true" Text="删除" />
<NewButton Visible="True" Text="新建" />
<CancelButton Visible="true" Text="取消" />
<UpdateButton Visible="true" Text="保存" />
<ClearFilterButton Visible="true" Text="取消过滤" />
</dxwgv:GridViewCommandColumn>
</Columns>
</dx:ASPxGridView>
代码详见《ASPxGridView.DataBind》
复选框列
<dxwgv:GridViewCommandColumn ShowSelectCheckbox="True"/>
<dxwgv:GridViewCommandColumn ShowSelectCheckbox="True">
<HeaderTemplate>
<input type="checkbox" onclick="grid.SelectAllRowsOnPage(this.checked);" title="选择/放弃选择本页的所有行" />
</HeaderTemplate>
<HeaderStyle HorizontalAlign="Center" />
</dxwgv:GridViewCommandColumn>
自定义按钮
“删除”按钮
<dx:GridViewCommandColumn Caption="删除">
<CustomButtons>
<dx:GridViewCommandColumnCustomButton ID="DeleteFile" Text="删除" />
</CustomButtons>
</dx:GridViewCommandColumn>
protected void gv_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
{
if (e.ButtonID == "DeleteFile")
{
long fileId = Convert.ToInt64(gv.GetRowValues(e.VisibleIndex, "FileId"));
string fileName = gv.GetRowValues(e.VisibleIndex, "FileName").ToString();
string filePath = Common.Config.Path.PhysicalUploadFolder + gv.GetRowValues(e.VisibleIndex, "FilePath").ToString();
System.IO.File.Delete(filePath);
using (DbFile db = new DbFile())
db.DelFile(fileId);
ShowData(this.FileBatchId);
}
}
“复制行”按钮
<dx:ASPxGridView runat="server" OnCustomButtonCallback="grid_CustomButtonCallback">
<Columns>
<dxwgv:GridViewCommandColumn VisibleIndex="">
<CustomButtons>
<dxwgv:GridViewCommandColumnCustomButton Text="复制行" ID="Copy" />
</CustomButtons>
</dxwgv:GridViewCommandColumn>
</Columns>
</dx:ASPxGridView>
Hashtable copiedValues;
protected void grid_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
{
if(e.ButtonID == "Copy")
{
copiedValues = new Hashtable();
foreach(string fieldName in copiedFields)
copiedValues[fieldName] = grid.GetRowValues(e.VisibleIndex, fieldName);
grid.AddNewRow();
}
}
protected void grid_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
{
if(copiedValues != null)
foreach(string fieldName in copiedFields)
e.NewValues[fieldName] = copiedValues[fieldName];
} 非绑定列(GridViewDataTextColumn)
<dxwgv:GridViewDataTextColumn FieldName="Total" UnboundType="Decimal" />
protected void grid_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e)
{
// Total = UnitPrice * Quantity
if(e.Column.FieldName == "Total")
{
decimal price = (decimal)e.GetListSourceFieldValue("UnitPrice");
int quantity = Convert.ToInt32(e.GetListSourceFieldValue("Quantity"));
e.Value = price * quantity;
}
}
模板列(GridViewDataTextColumn)
onhtmlrowcreated="grid_HtmlRowCreated"
<dxwgv:GridViewDataTextColumn Name="Percent" Caption="Change" FieldName="Change">
<DataItemTemplate>
<asp:Image ID="changeImage" runat="server" ImageUrl="~/Images/arGreen.gif" Visible="false" GenerateEmptyAlternateText="True" />
<asp:Label ID="changePercent" runat="server" Text="" />
<a href="javascript:void(0);" onclick="OnMoreInfoClick(this, '<%# Container.KeyValue %>')">更多...</a>
<a href="../pages/download.ashx?path=../uploads/<%#Eval("FilePath")%>&name=<%#Eval("FileName") %> " >下载</a>
</DataItemTemplate>
</dxwgv:GridViewDataTextColumn>
protected void grid_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e)
{
if (!grid.IsEditing && e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Data)
{
// 操作 Label 控件
Label label = grid.FindRowCellTemplateControl(e.VisibleIndex, null, "changePercent") as Label;
decimal change = (decimal)grid.GetRowValues(e.VisibleIndex, "Change");
label.Text = string.Format("{0:p}", change);
// 操作 Image 控件
System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)grid.FindRowCellTemplateControl(e.VisibleIndex, null, "changeImage");
img.Visible = false;
if(change != )
{
img.Visible = true;
img.ImageUrl = change < ? "~/Images/arRed.gif" : "~/Images/arGreen.gif";
label.ForeColor = change < ? Color.Red : Color.Green;
}
}
}
注:模板列中的事件如何写?手工写事件,如btn.OnClick += ...;
注:视图模板请参考文档《ASPxGridView.Templates》 ASPxGridView 事件
RowCreated(创建行数据时触发,类似 GridView 的 DataItemCreate 事件)
protected void grid_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
{
if(e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;
// 设置模板列lable控件值
Label label = grid.FindRowCellTemplateControl(e.VisibleIndex, null, "changePercent") as Label;
decimal change = (decimal)grid.GetRowValues(e.VisibleIndex, "Change");
label.Text = string.Format("{0:p}", change);
// 设置模板列image控件的图像
System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)grid.FindRowCellTemplateControl(e.VisibleIndex, null, "changeImage");
img.Visible = false;
if(change != ) {
img.Visible = true;
img.ImageUrl = change < ? "~/Images/arRed.gif" : "~/Images/arGreen.gif";
label.ForeColor = change < ? Color.Red : Color.Green;
}
}
HtmlRowPrepared(行准备?可在此设置行的展示效果,如背景)
protected void grid_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e)
{
bool hasError = e.GetValue("FirstName").ToString().Length <= ;
hasError = hasError || e.GetValue("LastName").ToString().Length <= ;
hasError = hasError || !e.GetValue("Email").ToString().Contains("@");
hasError = hasError || (int)e.GetValue("Age") < ;
DateTime arrival = (DateTime)e.GetValue("ArrivalDate");
hasError = hasError || DateTime.Today.Year != arrival.Year || DateTime.Today.Month != arrival.Month;
if(hasError) {
e.Row.ForeColor = System.Drawing.Color.Red;
}
}
UnboundColumnData (非绑定列数据填充)
protected void grid_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e)
{
if(e.Column.FieldName == "Total")
{
decimal price = (decimal)e.GetListSourceFieldValue("UnitPrice");
int quantity = Convert.ToInt32(e.GetListSourceFieldValue("Quantity"));
e.Value = price * quantity;
}
}
CustomColumnDisplayText(定制列文本展示)
protected void grid_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e)
{
if(object.Equals(e.Column, grid.Columns["Size"]))
e.DisplayText = GetSizeDisplayText(e.Value);
}
SummaryDisplayText(合计行文本展示)
protected void grid_SummaryDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewSummaryDisplayTextEventArgs e) {
if(e.Item.FieldName == "Size") {
e.Text = GetSizeDisplayText(e.Value);
}
}
HeaderFilterFillItems(自定义过滤器处理逻辑)
protected void grid_HeaderFilterFillItems(object sender, ASPxGridViewHeaderFilterEventArgs e)
{
if(object.Equals(e.Column, grid.Columns["Total"])) {
PrepareTotalFilterItems(e);
return;
}
if(object.Equals(e.Column, grid.Columns["Quantity"])) {
PrepareQuantityFilterItems(e);
return;
}
}
---------------------------------------------------------
回调处理
---------------------------------------------------------
CustomCallback(Ajax 回调处理)
<select id="selGridLayout" onchange="grid.PerformCallback(this.value);" >
<option selected="selected" value="">Country</option>
<option value="">Country, City</option>
<option value="">Company Name</option>
</select>
protected void grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
{
int layoutIndex = -;
if(int.TryParse(e.Parameters, out layoutIndex))
ApplyLayout(layoutIndex); // 更换布局
}
CustomButtonCallback(定制按钮的ajax回调处理)
protected void grid_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
{
if(e.ButtonID != "Copy") return;
copiedValues = new Hashtable();
foreach(string fieldName in copiedFields)
copiedValues[fieldName] = grid.GetRowValues(e.VisibleIndex, fieldName); grid.AddNewRow();
}
---------------------------------------------------------
编辑视图
---------------------------------------------------------
InitNewRow(新建行的数据初始化处理)
protected void grid_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
{
if(copiedValues == null) return;
foreach(string fieldName in copiedFields) {
e.NewValues[fieldName] = copiedValues[fieldName];
}
} CellEditorInitialize(编辑器初始化)
protected void grid_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
{
if(grid.IsEditing && !grid.IsNewRowEditing && e.Column.FieldName == "City")
{
string country = (string)grid.GetRowValuesByKeyValue(e.KeyValue, "Country");
ASPxComboBox combo = e.Editor as ASPxComboBox;
FillCityCombo(combo, country);
combo.Callback += new CallbackEventHandlerBase(cmbCity_OnCallback);
}
}
StartRowEditing(开始编辑)
protected void grid_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
{
if(!grid.IsNewRowEditing) {
grid.DoRowValidation();
}
}
RowValidating (行数据验证)
protected void grid_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
{
foreach(GridViewColumn column in grid.Columns) {
GridViewDataColumn dataColumn = column as GridViewDataColumn;
if(dataColumn == null) continue;
if(e.NewValues[dataColumn.FieldName] == null) {
e.Errors[dataColumn] = "Value can't be null.";
}
}
if(e.Errors.Count > ) e.RowError = "Please, fill all fields.";
if(e.NewValues["FirstName"] != null && e.NewValues["FirstName"].ToString().Length < ) {
AddError(e.Errors, grid.Columns["FirstName"], "First Name must be at least two characters long.");
}
if(e.NewValues["LastName"] != null && e.NewValues["LastName"].ToString().Length < ) {
AddError(e.Errors, grid.Columns["LastName"], "Last Name must be at least two characters long.");
}
if(e.NewValues["Email"] != null && !e.NewValues["Email"].ToString().Contains("@")) {
AddError(e.Errors, grid.Columns["Email"], "Invalid e-mail.");
}
int age = ;
int.TryParse(e.NewValues["Age"] == null ? string.Empty : e.NewValues["Age"].ToString(), out age);
if(age < ) {
AddError(e.Errors, grid.Columns["Age"], "Age must be greater than or equal 18.");
}
DateTime arrival = DateTime.MinValue;
DateTime.TryParse(e.NewValues["ArrivalDate"] == null ? string.Empty : e.NewValues["ArrivalDate"].ToString(), out arrival);
if(DateTime.Today.Year != arrival.Year || DateTime.Today.Month != arrival.Month) {
AddError(e.Errors, grid.Columns["ArrivalDate"], "Arrival date is required and must belong to the current month.");
}
if(string.IsNullOrEmpty(e.RowError) && e.Errors.Count > ) e.RowError = "Please, correct all errors."; if (e.NewValues["Name"] == null)
{
e.RowError = "功能名称不能为空,请填写功能名称";
return;
}
if (e.NewValues["Remarks"] == null)
{
e.RowError = "功能备注不能为空,请填写功能备注";
return;
}
}
行修改事件 RowUpdating
protected void gvFunction_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
{
functionModel.Name = e.NewValues[].ToString();// 组名称
functionModel.Remarks = e.NewValues[].ToString(); // 组备注
functionModel.FunctionId = e.Keys[].ToString();// ID
rmodel = client.FunctionEdit(functionModel);// 返回类型表
gvFunction.CancelEdit();//结束编辑状态
e.Cancel = true;
FunctionDataBind();//更新数据
} 行添加事件RowInserting
protected void gvFunction_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
{
functionModel.Name = e.NewValues[].ToString();// 组名称
functionModel.Remarks = e.NewValues[].ToString(); // 组备注
rmodel = client.FunctionSubmit(functionModel);// 返回类型表 gvFunction.CancelEdit();//结束编辑状态
e.Cancel = true;
FunctionDataBind();//更新数据
}
行删除事件RowDeleting
protected void gvFunction_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
{
functionModel.FunctionId = e.Keys[].ToString();// ID
client.FunctionInfoDelete(functionModel);
gvFunction.CancelEdit();//结束编辑状态
e.Cancel = true;
FunctionDataBind();//更新数据
} 初始化回调事件 Callback
protected void callbackPanel_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
{
strGroupID = e.Parameter.ToString();
DataBindInfo();// 初始化页面信息
SelectUser();// 查找组里面的所有用户
DataCheck(); } 获取行展开改变事件 DetailRowExpandedChanged
protected void gvGroup_DetailRowExpandedChanged(object sender, ASPxGridViewDetailRowEventArgs e)
{ SYSolution_WebUI.ServiceReference.GroupInfo groupInfoModel = (SYSolution_WebUI.ServiceReference.GroupInfo)((ASPxGridView)sender).GetRow(e.VisibleIndex);// 获取选中行实体
ASPxGridView gv = (ASPxGridView)gvGroup.FindDetailRowTemplateControl(e.VisibleIndex, "gvGroupName"); // 获取模板内aspxgridView ID名称
SYSolution_WebUI.ServiceReference.GroupInfo[] model = client.GroupSelUserList("GroupId='" + groupInfoModel.GroupId + "'");// 通过组ID值获取实体对象
if (model[].UserInfoList != null && gv != null)// 当用用户列表值与子aspxgridView不为空
{
gv.DataSource = model[].UserInfoList; // 子aspxgridView绑定数据源
gv.DataBind();
}
if (model[].UserInfoList[].Name == "") // 如果子aspxgridView中的用户列表为空时不显示 不展开
{
gvGroup.SettingsDetail.AllowOnlyOneMasterRowExpanded = false;
}
} 排序 事件中重新绑定数据 BeforeColumnSortingGrouping
protected void gvGroup_BeforeColumnSortingGrouping(object sender, ASPxGridViewBeforeColumnGroupingSortingEventArgs e)
{
gvGroup.DetailRows.CollapseAllRows();// 关闭所有DetailoRow gvGroup.DetailRows.ExpandRow();
}
重绑定数据使用时先选中行,再查看 FocusedRowChanged
Protected void aspxGridView_FocusedRowChanged(object sender,EventArgs e){} 行列绑定数据事件CustomUnboundColumnData
Protected void aspxGridView_CustomUnboundColumnData(object sender,EventArgs e){} .隐藏编辑列,在DataBound事件中
protected void ASPxGridView1_DataBound(object sender, EventArgs e)
{
if(ASPxGridView1.VisibleRowCount>)
{
//ASPxGridView1.Columns[命令列索引]
(ASPxGridView1.Columns[] as GridViewCommandColumn).NewButton.Visible = false;
}
}
/******************************************************************************************
*【Author】:ど溫柔s男爵シ
*【Date】:2013年06月20日
*【Notice】:
*1、本文为原创技术文章,首发博客园个人站点(http://wenku.baidu.com/view/a4242515cc7931b765ce1564.html),转载和引用请注明作者及出处。
*2、本文必须全文转载和引用,任何组织和个人未授权不能修改任何内容,并且未授权不可用于商业。
*3、本声明为文章一部分,转载和引用必须包括在原文中。
******************************************************************************************/
AspxGridView整理文档【转】的更多相关文章
- centos6编译安装zabbix3.0和中文支持整理文档
编者按: 最近公司部分业务迁移机房,为了更方便的监控管理主机资源,决定上线zabbix监控平台.运维人员使用2.4版本的进行部署,个人在业余时间尝鲜,使用zabbix3.0进行部署,整理文档如下,仅供 ...
- 帮哥们做的一个整理文档的小工具(C++ string的标准函数还是很给力的,代码在最下)
其实把程序用到生活中,真的能节约不少时间!程序的力量是无穷滴! 哥们的毕业设计是要做法律文书匹配之类的东东,有一步是要抽取所有的法律法规名称,而刚好我们要处理的文件中,法规的名称之前都有个‘.‘,所以 ...
- appium整理文档
from appium import webdriver import time,unittest,HTMLTestRunner class Testlogin(unittest.TestCase): ...
- 关于Mysql几周的整理文档
https://files.cnblogs.com/files/swobble/mysql.rar 内容包括 版本测试(5.5,5.6,5.7) 平台测试(windows所有平台) 文件说明 精简说明 ...
- 批量删除wps文档里的回车符的方法!WPS使用技巧分享!
有时候整理文档的时候,如果是从网上复制的文字,可能会因为复制而产生很多的回车符.怎样能批量去掉这些个回车符呢,下面马上告诉你批量删除wps文档里的回车符的方法!WPS使用技巧分享! 想要批量删除批量删 ...
- C#如何给PDF文档添加注释
整理文档时,我们可能会需要在一些或一段文字上添加注释加以说明,那如何以编程的方式实现呢?本文将实例讲述C#中如何使用免费组件给PDF文档添加文本注释,包括自由文本注释.自由文本注释能允许我们自定义它的 ...
- vue新手入门指导,一篇让你学会vue技术栈,本人初学时候的文档
今天整理文档突然发现了一份md文档,打开一看 瞬间想起当年学习vue的艰难路,没人指导全靠自己蒙,下面就是md文档内容,需要的小伙伴可以打开个在线的md编译器看一看,我相信不管是新人还是老人 入门总 ...
- 使用adobe pdf去除PDF文档中的批量雷同文本
一.问题的提出 MgoSoft tiff to pdf软件没有提供中国地区的非VISA用户的购买渠道,中国通常都是银联标识走天下,卡不是VISA买不了这样的软件, 那么, MgoSoft tiff t ...
- dotNET跨平台相关文档整理
一直在从事C#开发的相关技术工作,从C# 1.0一路用到现在的C# 6.0, 通常情况下被局限于Windows平台,Mono项目把我们C#程序带到了Windows之外的平台,在工作之余花了很多时间在M ...
随机推荐
- 第二百八十七天 how can I 坚持
终于把假请下来了,没有想象的那么复杂. 忘退车票了.明天应该有手续费了,现在又维护了,哎.10%的手续费了.7块钱,没了.希望不会白回去一趟啊. sql,group by having .还是学不会 ...
- HDU 5675 ztr loves math (数学推导)
ztr loves math 题目链接: http://acm.hust.edu.cn/vjudge/contest/123316#problem/A Description ztr loves re ...
- #elif
http://baike.sogou.com/v72031124.htm?fromTitle=%23elif #else指令用于某个#if指令之后,当前面的#if指令的条件不为真时,就编译#else后 ...
- hibernate id生成器配置
1.uuid配置 <id name="tomdId" type="java.lang.String"> <column name=" ...
- Spring的ControllerAdvice注解
@ControllerAdvice,是spring3.2提供的新注解,其实现如下所示: @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUN ...
- Autofac介绍
原帖:http://www.cnblogs.com/xupng/archive/2011/07/12/2104766.html Autofac为何物?它是.NET世界里现存的几种IOC框架其中之一,传 ...
- Activator.CreateInstance 方法 (Type) 的用法
转自:http://www.cnblogs.com/lmfeng/archive/2012/01/30/2331666.html Activator.CreateInstance 方法 (Type) ...
- android知乎小圆圈刷新效果
前几天看到包括知乎在内的很多应用都使用到了一种小圆圈划动刷新的效果,仔细查了一下,原来是android v7包里面最新的刷新效果.使用起来也是十分简单的. 首先先建立一个activity,在布局文件里 ...
- Django搭建博客后台
转载自:http://sanwen8.cn/p/1cboypN.html 首先创建项目和blog应用: 在cmd命令行下,输入: django-admin.py startproject myblog ...
- SQL Server活动监视器
打开SQL Server活动监视器: