打印本文 打印本文 关闭窗口 关闭窗口
为ASP.NET组件加上Collection集合属性(C#)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数5312  更新时间:2009/4/23 10:45:09  文章录入:mintao  责任编辑:mintao
        {

            if(state != null)

            {

                object[] viewState = (object[])state;

                for(int i = 0 ; i < viewState.Length ; i ++)

                {

                    ((IStateManager)List[i]).LoadViewState(viewState[i]);

                }

            }

        }

        #endregion

    }

}

最后,新建一个WEB控件库,名称为:NSWebPanel,以下是源代码:

using System;

using System.Web.UI;

using System.Collections;

using System.Web.UI.WebControls;

using System.ComponentModel;

 

namespace NSWebPanel

{

    /// <summary>

    /// WebCustomControl1 的摘要说明。

    /// </summary>

 

    public class WebCustomControl1 : System.Web.UI.WebControls.WebControl,INamingContainer,IStateManager

    {

        private const string SCRIPT = "<table id=''''t'''' border=''''1'''' width=''''228'''' height=''''145'''' bordercolor=''''#000000'''' cellspacing=''''0'''' cellpadding=''''0'''' bordercolorlight=''''#000000'''' bordercolordark=''''#FFFFFF''''>\n" +

        "<tr>\n" +

        "<td width=''''228'''' height=''''20''''>\n" +

        "<table border=''''0'''' width=''''100%'''' cellpadding=''''0'''' cellspacing=''''0''''>\n" +

        "<tr>\n" +

        "<td width=''''10%'''' bgcolor=''''#CCCCFF'''' id=''''sign'''' onmousedown=''''Shink()'''' align=''''center'''' style=''''cursor: hand; font-family: Webdings''''>5</td>\n" +

        "<td width=''''90%'''' style=''''font-size:14px''''>\n" +

             "<p align=''''center''''>{0}</td>\n" +

        "</tr>\n" +

        "</table>\n" +

        "</td>\n" +

        "</tr>\n" +

        "<tr id=''''downBlock''''>\n" +

        "<td width=''''228'''' height=''''113''''>\n" +

 

        "<table border=''''0'''' cellpadding=''''0'''' cellspacing=''''0'''' width=''''100%'''' height=''''106'''' style=''''font-size:14px''''>\n" +

        "<tr>\n" +

        "<td width=''''100%'''' align=''''center'''' height=''''21'''' id=''''tr1''''><a target=''''_blank'''' href=''''{6}''''>{1}</a></td>\n" +

        "</tr>\n" +

        "<tr>\n" +

        "<td width=''''100%'''' align=''''center'''' height=''''21'''' id=''''tr2''''><a target=''''_blank'''' href=''''{7}''''>{2}</a></td>\n" +

        "</tr>\n" +

      &n

上一页  [1] [2] [3] [4] [5] [6] [7] [8]  下一页

打印本文 打印本文 关闭窗口 关闭窗口