NetAdvantage的UltraWebGrid的全选控件设计
来源:互联网 发布:超声波洗牙器 知乎 编辑:程序博客网 时间:2024/04/28 17:17
【对Infragistics.WebUI.UltraWebGrid.UltraWebGrid的某一列进行全选,当然这一列的Type是Checkbox】
代码很简单,主要是注册一段js,根据UltraWebGrid的实现特点,巧妙调用其js库。这样不要postback到Server端,避免无谓刷新。
两个主要属性是:
1.要设置的Grid的ID——ControlGridID;
2.要设置的Grid的列的索引号——CheckColumnIndex。
- using System;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.ComponentModel;
- namespace SelAllControl
- {
- /// <summary>
- /// SelectAll 的摘要说明。
- /// </summary>
- [DefaultProperty("Text"),
- ToolboxData("<{0}:SelectAll runat=server></{0}:SelectAll>")]
- public class SelectAll : System.Web.UI.WebControls.CheckBox
- {
- private string m_strControlGridID;
- private int m_iColIndex;
- public SelectAll()
- {
- m_iColIndex = 0;
- }
- /// <summary>
- /// 获取并设置需要控制的Grid的ID
- /// </summary>
- [Category("Appearance")]
- [Description("设置需要控制的Grid的ID")]
- public string ControlGridID
- {
- get
- {
- return this.m_strControlGridID;
- }
- set
- {
- this.m_strControlGridID = value;
- }
- }
- /// <summary>
- /// 获取并设置需要控制的Grid的CheckBox列的索引号
- /// 默认为0
- /// </summary>
- [Category("Appearance")]
- [Description("设置需要控制的Grid的ID")]
- [DefaultValue(0)]
- public int CheckColumnIndex
- {
- get
- {
- return m_iColIndex;
- }
- set
- {
- m_iColIndex = value;
- }
- }
- private void AssignScript()
- {
- string strScript = "var strGridID = '"+this.ControlGridID+"'; if(null==strGridID || strGridID.length<=0){return;} try {var oGrid = o"+this.ControlGridID+"; var oRows = oGrid.Rows; var objCurState = document.getElementById('"+this.ClientID+"'); var objSetValue = objCurState.checked; for(i=0;i<oRows.length;i++) { (oRows.getRow(i).getCell("+CheckColumnIndex.ToString()+")).setValue(objSetValue); }} catch(e){ return; }";
- base.Attributes.Add("onClick",strScript);
- }
- /// <summary>
- /// 将此控件呈现给指定的输出参数。
- /// </summary>
- /// <param name="output"> 要写出到的 HTML 编写器 </param>
- protected override void Render(HtmlTextWriter output)
- {
- this.ID = this.ClientID;
- AssignScript();
- base.Render(output);
- }
- }
- }
- NetAdvantage的UltraWebGrid的全选控件设计
- NetAdvantage的UltraWebGrid的全选控件设计
- NetAdvantage的UltraWebGrid的全选控件设计
- Infragistics NetAdvantage UltraWebGrid中固定列的实现方法
- NetAdvantage控件的汉化办法
- 在客户端使用javascript遍历Infragistics NetAdvantage UltraWebGrid中每个单元格的内容
- Infragistics.NetAdvantage.Ultimate.2011.vol1是最后一个支持Ultrawebgrid的版本
- Infragistics的NetAdvantage控件出错排除方法
- Netadvantage UltraGrid UltraWebGrid编程手记
- Infragistics NetAdvantage UltraWebGrid使用技巧
- ASPxGridView控件的全选
- Infragistics NetAdvantage 控件资源释放问题的实际经验
- 我遇到了UltraWebGrid控件调试错误的解决办法
- UltraWebGrid的自动序号
- NetAdvantage UltraWebGrid v4.3之经验汇总
- [转]Infragistics NetAdvantage UltraWebGrid使用技巧
- [转]Infragistics NetAdvantage UltraWebGrid使用技巧
- Infragistics.NetAdvantage.UltraWebGrid增加多表头[C#]
- 总结的网站开发的要点
- Ajax and REST Recipes: A Problem-Solution Approach
- Compute the maximal length of the increasing subsequence in an array
- 关闭窗口后立即销毁Session并通过ADO层实现插入日志方法
- IT Auditing: Using Controls to Protect Information Assets
- NetAdvantage的UltraWebGrid的全选控件设计
- 门户网站开发总结
- Pro SQL Server 2005 Replication
- 我的文件系统启动
- xfire 做webservice总结
- The Definitive Guide to SUSE Linux Enterprise Server
- Fundamentals of WiMAX: Understanding Broadband Wireless Networking
- WinForm数据绑定-简单绑定1
- Game Engine Toolset Development