解决方案 »

  1.   


    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.ComponentModel;
    using System.Web.UI;
    using System.Web.UI.WebControls;namespace SqlSevrver
    {
        [DefaultProperty("TextBoxValue")]
        [ToolboxData("<{0}:Sql runat=server></{0}:Sql>")]
        public class SqlGridView : CompositeControl,INamingContainer 
        {
            private Label lb;
            private int lang = 6;
            private int GridViewwidth = 100;
            private int GridViewheight = 1;
            private GridView gd;
            private TextBox tb;
            private Button bt;
            [Category("SqlServer属性")]
            [Description("GridView的单元格长度(int)类型")]
            public Unit GridView1Width
            {
                get
                {
                    this.EnsureChildControls();
                    gd.Width = Unit.Parse(Convert.ToString(gd.Columns.Count * GridViewwidth));
                    return gd.Width;
                }
                set
                {
                    this.EnsureChildControls();
                    GridViewwidth = Convert.ToInt32(value);            }
            }
      

  2.   


      [Category("SqlServer属性")]
            [Description("GridView的单元格高度(int)类型")]
            public Unit GridViewHeight
            {
                get
                {
                    this.EnsureChildControls();
                    gd.Height = Unit.Parse(Convert.ToString(GridViewheight));
                    return gd.Height;
                }
                set
                {
                    this.EnsureChildControls();
                    GridViewheight = Convert.ToInt32(value);
                }
            }
            [Category("SqlServer属性")]
            [Description("GridView中长度为X之后的数字全部用....表示")]
            public int GridViewToolTip
            {
                get
                {
                    this.EnsureChildControls();                return lang;
                }
                set
                {
                    this.EnsureChildControls();
                    lang = Convert.ToInt32(value);
                }
            }        [Category("SqlServer属性")]
            [Description("文本框的值")]
            public string Textbox
            {
                get
                {
                    this.EnsureChildControls();
                    return tb.Text;
                }
                set
                {
                    this.EnsureChildControls();
                    tb.Text = value;
                }
            }
            [Category("SqlServer属性")]
            [Description("文本框的宽度")]
            public Unit TextBoxWeith
            {
                get
                {
                    this.EnsureChildControls();
                    return tb.Width;
                }
                set
                {
                    this.EnsureChildControls();
                    tb.Width = value;
                }
            }
      

  3.   


     [Category("SqlServer属性")]
            [Description("GridView的单元格高度(int)类型")]
            public Unit GridViewHeight
            {
                get
                {
                    this.EnsureChildControls();
                    gd.Height = Unit.Parse(Convert.ToString(GridViewheight));
                    return gd.Height;
                }
                set
                {
                    this.EnsureChildControls();
                    GridViewheight = Convert.ToInt32(value);
                }
            }
            [Category("SqlServer属性")]
            [Description("GridView中长度为X之后的数字全部用....表示")]
            public int GridViewToolTip
            {
                get
                {
                    this.EnsureChildControls();                return lang;
                }
                set
                {
                    this.EnsureChildControls();
                    lang = Convert.ToInt32(value);
                }
            }        [Category("SqlServer属性")]
            [Description("文本框的值")]
            public string Textbox
            {
                get
                {
                    this.EnsureChildControls();
                    return tb.Text;
                }
                set
                {
                    this.EnsureChildControls();
                    tb.Text = value;
                }
            }