DevExpress

  DevExpress 是一个软件公司,全称是 Developer Express,主要从事编程控件/组件的开发。

  DevExpress 也特指此公司出品的控件集合或某系列控件或其中某控件。

  DevExpress 开发的数据库控件有很强的实力,不仅功能丰富,应用简便,而且界面华丽,更可方便定制。对于编程人员来说是个不错的选择。它的菜单栏控件更具代表,完全可以替代开发环境提供的基本控件,而让您编写的程序或软件更显专业化。它还提供完善的帮助系统,资料详尽,可以快速入手。有些高级控件更是零代码的,非常易于使用。

  DevExpress 控件根据应用类型分为:

  1、Windows Controls

  2、Web Controls

  3、Reporting / Printing Suites

  4、IDE Productivity Tools

  5、Business Application Frameworks

  

注:在安装完成后的本地demo中有非常详尽的代码,在官方网站上有非常详尽的帮助,请关注 

  

 

 

 

AspxGridView控件(DX表格控件)

 

DevExpress ASPxGridView 使用文档一:概述

http://www.cnblogs.com/laogaoge/archive/2010/09/20/1831527.html

DevExpress ASPxGridView 使用文档二:列

http://www.cnblogs.com/laogaoge/archive/2010/09/20/1831528.html

DevExpress ASPxGridView 使用文档三:编辑

http://www.cnblogs.com/laogaoge/archive/2010/09/20/1831530.html

DevExpress ASPxGridView 使用文档四:数据源

http://www.cnblogs.com/laogaoge/archive/2010/09/20/1831532.html

DevExpress ASPxGridView 使用文档五:事件

http://www.cnblogs.com/laogaoge/archive/2010/09/20/1831534.html

DevExpress ASPxGridView 使用文档六:模板

http://www.cnblogs.com/laogaoge/archive/2010/09/20/1831535.html

DevExpress ASPxGridView 使用文档七:客户端API

http://www.cnblogs.com/laogaoge/archive/2010/09/20/1831537.html

 

AspxGridView常见Q&A(示例代码)

  1. 如果增加全选功能

                           <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Name="0" Width="20px">

                               <HeaderTemplate>

                                   <table cellspacing="0" cellpadding="0" style="width: 100%; border-collapse: collapse;">

                                       <tr>

                                            <td style="color: White;">

                                               <input type="checkbox" onclick="UserList.SelectAllRowsOnPage(this.checked);" title="Select/Unselect all rows on the page" />

                                           </td>

                                       </tr>

                                   </table>

                               </HeaderTemplate>

                               <CellStyle Paddings-Padding="0">

                                   <Paddings Padding="0px"></Paddings>

                               </CellStyle>

                           </dx:GridViewCommandColumn>

  1. 如何取到选择行

function OnRemindSetting() {

   var selectcount = UserList.GetSelectedRowCount();

   if (selectcount > 1) {

       UserList.GetSelectedFieldValues('IDCard', OnRemindSettingCallBack)

   } else if (selectcount < 1) {

       alert('您没有选中任何客户!');

   }

   else {

       UserList.GetSelectedFieldValues('IDCard', OnRemindSettingCallBack)

   }

}

function OnRemindSettingCallBack(selectedValues) {

   if (selectedValues.length == 0) return;

   top.location.href = "Remind/RemindSetting.aspx?CardID=" + selectedValues;

}

       protected void UserList_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)

       {

           if (!string.IsNullOrEmpty(e.Parameters))

           {

               string[] paras = e.Parameters.Split('|');

               if (paras.Length > 1)

               {

                   string sortColumn = paras[1];

                   GridViewDataColumn col = (sender as ASPxGridView).Columns[sortColumn] as GridViewDataColumn;

                   DevExpress.Data.ColumnSortOrder sortOrder = DevExpress.Data.ColumnSortOrder.Descending;

                   if (col.SortOrder == DevExpress.Data.ColumnSortOrder.Descending)

                       sortOrder = DevExpress.Data.ColumnSortOrder.Ascending;

                   (sender as ASPxGridView).ClearSort();

                   col.SortOrder = sortOrder;

               }

               else

                {

                   SetDetailVisible(e.Parameters);

               }

           }

       }

 

  1. 如何增加超链接列

                           <dx:GridViewDataHyperLinkColumn Caption="客户姓名" FieldName="GUID" VisibleIndex="1"

                               Name="1">

                               <PropertiesHyperLinkEdit NavigateUrlFormatString="../ShowCustomer.aspx?guid={0}"

                                   TextField="客户姓名">

                               </PropertiesHyperLinkEdit>

                           </dx:GridViewDataHyperLinkColumn>

  1. 如何格式化显示

                           <dx:GridViewDataTextColumn Caption="现有收益率" FieldName="现有收益率" VisibleIndex="6" Name="6"

                               SortOrder="Descending">

                               <PropertiesTextEdit DisplayFormatString="{0:0.00}%">

                               </PropertiesTextEdit>

                           </dx:GridViewDataTextColumn>

  1. 如何自定义排序

                       <ClientSideEvents ColumnSorting="function(s, e) {

               debugger;

               var sortcolumn = e.column.fieldName;

               s.PerformCallback('null|' +sortcolumn);

               setFlag();

               e.cancel=true;

}" />

  1. 如何导出excel

                   <dxwgv:ASPxGridViewExporter ID="gridExport" runat="server" GridViewID="UserList">

                   </dxwgv:ASPxGridViewExporter>

 

           this.gridExport.WriteXlsToResponse();

  1. 如何格式化列文本

       protected void UserList_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e)

      {

           string source = e.GetFieldValue("客户类别").ToString();

           string fa = e.GetFieldValue("FundAccount").ToString();

           string nonesale = (e.GetFieldValue("是否不动户")==null)?"":e.GetFieldValue("是否不动户").ToString();

           switch (e.Column.Name)

           {

               case "2"://证件号码

                   if (string.Compare(source, "手动添加") == 0)

                   {

                       e.DisplayText = "";

                   }

                   break;              

           }

       }

  1. 如何锁定列

           this.UserList.Columns[0].FixedStyle = GridViewColumnFixedStyle.Left;

           this.UserList.Columns[1].FixedStyle = GridViewColumnFixedStyle.Left;

           this.UserList.Columns[2].FixedStyle = GridViewColumnFixedStyle.Left;

  1. 如何自定义样式

CssFilePath="~/Themes/css/DxTable.css" CssPostfix="UserTableCSS" CssClass="table1_dx"

 

源码说明

源码地址:

页面地址: NBF/WebUI/WFTWeb/DxExpress/AspxGridView.aspx

回调方法

一般使用的回调分三种

ASPxCallbackPanel   回调容器,类似UpdatePanel

ASPxCallback       回调组件

ASPxGridView       控制自身回调,如表格控件(机制同上两个)

 

ASPxCallbackPanel的使用

http://blog.csdn.net/wServices/archive/2009/06/18/4280617.aspx

ASPxCallback的使用

http://xuyutanggg.blog.163.com/blog/static/1925716920109634747768/

 

通过ASPxCallbackpanel与上一节的AspxCallBack的使用,我们发现DevExpress Aspx控件的回调方法都是一致的。

  1. 即添加ClientInstanceName
  2. 注册服务器端的Callback事件
  3. 最后调用CallbackComplete事件,进行必要的处理(可选)

 

ASPxCallbackpanel补充(示例代码)

与js互访

       protected void UserCallbackPanel_CustomJSProperties(object sender, CustomJSPropertiesEventArgs e)

       {

           e.Properties.Add("cpRecordCount", recordCount);

           e.Properties.Add("cpQueryString", queryString);

       }

Js中使用

var array = UserCallbackPanel.cpQueryString

ASPxCallback补充(示例代码)

<dx:ASPxCallback ID="ASPxCallback" runat="server" ClientInstanceName="ASPxCallback"

   OnCallback="ASPxCallback_Callback">

   <ClientSideEvents CallbackComplete="function(s, e) {

          //SetCurrentCustomer(e.result);

           document.getElementById('lblSummaryInfo').innerHTML = e.result;

       }" BeginCallback="function(s,e){document.getElementById('lblSummaryInfo').innerHTML='正在计算汇总信息,请稍候...';}" />

</dx:ASPxCallback>

 

源码说明

源码地址:

页面地址: NBF/WebUI/WFTWeb/DxExpress/ASPxCallback.aspx

JS文件地址: NBF/WebUI/WFTWeb/Script/AspxCallback.js

Last edited Apr 2, 2011 at 2:21 AM by zp, version 2

Comments

No comments yet.