中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)

發布時間:2020-04-21 20:57:39 來源:網絡 閱讀:513 作者:webabcd 欄目:web開發
GridView既強大又好用。為了讓它更強大、更好用,我們來寫一個繼承自GridView的控件。
[索引頁]
[×××]


擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)


作者:webabcd
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)/*正式版的實現 開始*/
介紹
擴展GridView控件:
聯動復選框(復選框的全選和取消全選)。選中指定的父復選框,則設置指定的所有子復選框為選中狀態;取消選中指定的父復選框,則設置指定的所有子復選框為取消選中狀態。如果指定的所有子復選框為均選中狀態,則設置指定的父復選框為選中狀態;如果指定的所有子復選框至少有一個為取消選中狀態,則設置指定的父復選框為取消選中狀態

使用方法(設置CascadeCheckboxes集合屬性):
ParentCheckboxID - 模板列中 父復選框ID
ChildCheckboxID - 模板列中 子復選框ID
YYControls.Helper.SmartGridView中的靜態方法
List<DataKey> GetCheckedDataKey(GridView gv, int columnIndex)
List<DataKey> GetCheckedDataKey(GridView gv, string checkboxId)


關鍵代碼
js
/*聯動復選框 開始*/
var yy_sgv_ccGridView_pre = new Array(); // cs中動態向其灌數據(GridView內控件ID的前綴數組)
var yy_sgv_ccAll_post = new Array(); // cs中動態向其灌數據(全選復選框ID的后綴數組)
var yy_sgv_ccItem_post = new Array(); // cs中動態向其灌數據(項復選框ID的后綴數組)

function yy_sgv_ccCheck(e)    
{
/// <summary>單擊復選框時</summary>

        var evt = e || window.event; // FF || IE
        var obj = evt.target || evt.srcElement    // FF || IE

        var ccIndex = -1;
        for (var i=0; i<yy_sgv_ccGridView_pre.length; i++)
        {        
                if (obj.id.yy_sgv_startsWith(yy_sgv_ccGridView_pre[i]))
                {
                        ccIndex = i;
                        break;
                }
        }
        
        if (ccIndex != -1)
        {
                if (obj.id.yy_sgv_endsWith(yy_sgv_ccAll_post[i]))
                {
                        yy_sgv_ccCheckAll(ccIndex, obj.checked);
                }
                else if (obj.id.yy_sgv_endsWith(yy_sgv_ccItem_post[i]))
                {
                        yy_sgv_ccCheckItem(ccIndex);
                }
        }
}

function yy_sgv_ccCheckAll(ccIndex, isCheckAll)
{
/// <summary>設置全選復選框的狀態</summary>

        var elements =    document.getElementsByTagName("INPUT");
        
        for (i=0; i< elements.length; i++)    
        {                
                if (elements[i].type == 'checkbox'    
                        && elements[i].id.yy_sgv_startsWith(yy_sgv_ccGridView_pre[ccIndex])    
                        && elements[i].id.yy_sgv_endsWith(yy_sgv_ccItem_post[ccIndex]))    
                {
                        elements[i].checked = isCheckAll;
                        
                        if (yy_sgv_crClassName != '')
                        {
                                yy_sgv_changeCheckedRowCssClass(elements[i], yy_sgv_crClassName, false);
                        }
                }
        }        
}

function yy_sgv_ccCheckItem(ccIndex)
{
/// <summary>單擊項復選框時</summary>

        var elements =    document.getElementsByTagName("INPUT");
        
        var checkedNum = 0;
        var uncheckedNum = 0;
        
        for (i=0; i< elements.length; i++)    
        {                
                if (elements[i].type == 'checkbox'    
                        && elements[i].id.yy_sgv_startsWith(yy_sgv_ccGridView_pre[ccIndex])    
                        && elements[i].id.yy_sgv_endsWith(yy_sgv_ccItem_post[ccIndex]))    
                {
                        if (elements[i].checked)
                        {
                                checkedNum++;
                        }
                        else
                        {
                                uncheckedNum++;
                        }
                }
        }
        
        if (uncheckedNum == 0)
        {
                yy_sgv_ccCheckCheckbox(yy_sgv_ccGridView_pre[ccIndex], yy_sgv_ccAll_post[ccIndex], true)
        }
        else
        {
                yy_sgv_ccCheckCheckbox(yy_sgv_ccGridView_pre[ccIndex], yy_sgv_ccAll_post[ccIndex], false)
        }
}

function yy_sgv_ccCheckCheckbox(pre, post, isCheckAll)
{
/// <summary>設置項復選框的狀態</summary>

        var elements =    document.getElementsByTagName("INPUT");
        
        for (i=0; i< elements.length; i++)    
        {                
                if (elements[i].type == 'checkbox'
                        && elements[i].id.yy_sgv_startsWith(pre)    
                        && elements[i].id.yy_sgv_endsWith(post))    
                {
                        elements[i].checked = isCheckAll;
                        break;
                }
        }        
}

function yy_sgv_ccListener()
{
/// <summary>監聽所有聯動復選框的單擊事件</summary>

        var elements =    document.getElementsByTagName("INPUT");
        
        for (i=0; i< elements.length; i++)    
        {                
                if (elements[i].type == 'checkbox')    
                {
                        for (j=0; j<yy_sgv_ccGridView_pre.length; j++)
                        {
                                if (elements[i].id.yy_sgv_startsWith(yy_sgv_ccGridView_pre[j])    
                                        && (elements[i].id.yy_sgv_endsWith(yy_sgv_ccAll_post[j]) || elements[i].id.yy_sgv_endsWith(yy_sgv_ccItem_post[j])))
                                {
                                        yy_sgv_addEvent(elements[i], 'click', yy_sgv_ccCheck);    
                                        break;
                                }
                        }
                }
        }        
}
        
if (document.all)
{
        window.attachEvent(' yy_sgv_ccListener)
}
else
{
        window.addEventListener('load', yy_sgv_ccListener, false);
}
/*聯動復選框 結束*/
 
c#
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.Collections.Generic;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.Text;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.Web.UI.WebControls;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.Web.UI;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)namespace YYControls.SmartGridViewFunction
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選){
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        /// 擴展功能:聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        public class CascadeCheckboxFunction : ExtendFunction
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// 構造函數
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                public CascadeCheckboxFunction()
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        : base()
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// 構造函數
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <param name="sgv">SmartGridView對象</param>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                public CascadeCheckboxFunction(SmartGridView sgv)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        : base(sgv)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// 擴展功能的實現
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                protected override void Execute()
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        this._sgv.PreRender += new EventHandler(_sgv_PreRender);
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// SmartGridView的PreRender事件
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <param name="sender"></param>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <param name="e"></param>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                void _sgv_PreRender(object sender, EventArgs e)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        // 構造向數組中添加成員的腳本
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        string scriptString = "";
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        foreach (CascadeCheckbox cc in this._sgv.CascadeCheckboxes)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                scriptString += String.Format("yy_sgv_ccGridView_pre.push('{0}');", Helper.Common.GetChildControlPrefix(this._sgv));
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                scriptString += String.Format("yy_sgv_ccAll_post.push('{0}');", cc.ParentCheckboxID);
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                scriptString += String.Format("yy_sgv_ccItem_post.push('{0}');", cc.ChildCheckboxID);
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        // 注冊向數組中添加成員的腳本
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        if (!this._sgv.Page.ClientScript.IsClientScriptBlockRegistered(String.Format("yy_sgv_cascadeCheckbox_{0}", this._sgv.ID)))
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                this._sgv.Page.ClientScript.RegisterClientScriptBlock
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                (
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        this._sgv.GetType(),
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        String.Format("yy_sgv_cascadeCheckbox_{0}", this._sgv.ID),
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        scriptString,
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        true
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                );
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)}
 
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)/*正式版的實現 結束*/
 
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)/*測試版的實現 開始*/
 
介紹
平時使用GridView的時候經常要給每行加一個復選框,然后還需要放置一個單獨的全選復選框,通過單擊它來讓這些復選框全選或取消全選,每次實現這樣的功能都要寫一段javascript,麻煩,所以擴展它。


控件開發
1、新建一個繼承自GridView的類。
/// <summary>
/// 繼承自GridView
/// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)[ToolboxData(@"<{0}:SmartGridView runat='server'></{0}:SmartGridView>")]
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)public class SmartGridView : GridView
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選){
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)}
 
2、新建一個JavaScriptConstant類,把我們要用到的javascript存在一個常量里
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.Collections.Generic;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.Text;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)namespace YYControls.SmartGridView
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選){
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        /// javascript
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        public class JavaScriptConstant
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                internal const string jsCheckAll = @"<script type=""text/javascript"">
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                //<![CDATA[
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                // 隱藏字段的ID,用于存每組的全選復選框ID
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                var hdnAllName = '[$AllName$]';
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                // 隱藏字段的ID,用于存每的項復選框ID
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                var hdnItemName = '[$ItemName$]';
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                // 組分隔符,一個 全選復選框 和其對應的n個 項復選框 為一個組
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                var groupSeparator = '[$GroupSeparator$]';
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                // 項分隔符,項復選框 每個項之間的分隔符
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                var itemSeparator = '[$ItemSeparator$]';
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                var strAlls = GetObject(hdnAllName).value;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                var strItems = GetObject(hdnItemName).value;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                // 全選復選框數組
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                var aryAlls = strAlls.split(groupSeparator);
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                // 項復選框數組,每行有一個組的所有項復選框
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                var aryItems = strItems.split(groupSeparator);
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                // 全選復選框被單擊,參數為 該全選復選框這個對象
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                function ClickCheckAll(objAll)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        // 每個全選復選框
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        for (var i=0; i<aryAlls.length; i++)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                // 該全選復選框是所單擊的全選復選框
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                if (aryAlls[i] == objAll.id)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        // 該全選復選框同組下的項復選框數組
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        aryItem = aryItems[i].split(itemSeparator);
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        for (var j=0; j<aryItem.length; j++)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                // 單擊的全選復選框是選中狀態,并且項復選框不是disabled,則選中
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                if (objAll.checked && !GetObject(aryItem[j]).parentElement.disabled)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                        GetObject(aryItem[j]).checked = true;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                // 否則
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                else
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                        GetObject(aryItem[j]).checked = false;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        break;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                // 項復選框被單擊
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                function ClickCheckItem()
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        // 每組項復選框
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        for (var i=0; i<aryItems.length; i++)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                // 該組的所有項復選框數組
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                aryItem = aryItems[i].split(itemSeparator);
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                // 標記,是否同組的項復選框都被選中
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                var bln = true;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                for (var j=0; j<aryItem.length; j++)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        // 如果該項復選框沒被選中,并且不是disabled,則bln設為false
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        if (!GetObject(aryItem[j]).checked && !GetObject(aryItem[j]).parentElement.disabled)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                bln = false;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                                break;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                // bln為true,則設置同組的全選復選框為選中
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                if (bln)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        GetObject(aryAlls[i]).checked = true;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                // 否則
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                else
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                        GetObject(aryAlls[i]).checked = false;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                function GetObject(param)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        return document.getElementById(param);
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                //]]>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                </script>";
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)}
 
3、新建一個CheckboxAll類,有兩個屬性
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.Collections.Generic;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.Text;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.ComponentModel;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)using System.Web.UI;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)namespace YYControls.SmartGridView
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選){
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        /// CheckboxAll 的摘要說明。
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        [ToolboxItem(false)]
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        public class CheckboxAll
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                private string _checkboxAllID;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// 模板列全選復選框ID
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                public string CheckboxAllID
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        get { return _checkboxAllID; }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        set { _checkboxAllID = value; }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                private string _checkboxItemID;
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// 模板列項復選框ID
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                public string CheckboxItemID
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        get { return _checkboxItemID; }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        set { _checkboxItemID = value; }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// ToString()
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// </summary>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                /// <returns></returns>
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                public override string ToString()
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                {
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                        return "CheckboxAll";
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)                }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)        }
擴展GridView控件(4) - 聯動復選框(復選框的全選和取消全選)}
 
 
 
未完待續>>
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

平果县| 奇台县| 道真| 友谊县| 常山县| 张掖市| 铜陵市| 汽车| 汝阳县| 鹿邑县| 乌兰察布市| 宁南县| 文化| 珲春市| 汉沽区| 韶山市| 双城市| 汤阴县| 区。| 南皮县| 荆州市| 会宁县| 南漳县| 隆回县| 开封市| 漳平市| 漠河县| 孙吴县| 福海县| 龙胜| 临泽县| 张家界市| 平谷区| 广宁县| 鄂州市| 阳城县| 斗六市| 嘉祥县| 上杭县| 大厂| 黄浦区|