SheetGridView.cs
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:3k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Web;
  3. using System.Web.UI;
  4. using System.ComponentModel;
  5. using System.Drawing;
  6. using System.Drawing.Design;
  7. [assembly: TagPrefix("OThinker.H3.WorkSheet", "SheetControls")]
  8. namespace OThinker.H3.WorkSheet
  9. {
  10.     /// <summary>
  11.     /// SheetGridView 的摘要说明。
  12.     /// </summary>
  13.     /// 
  14.     [ToolboxBitmap(typeof(SheetGridView), "OThinker.H3.WorkSheet.SheetGridView.bmp")]
  15.     [ToolboxData("<{0}:SheetGridView runat=server></{0}:SheetGridView>")]
  16.     public class SheetGridView :
  17.         System.Web.UI.WebControls.GridView,
  18.         ISheetControl
  19.     {
  20.         public SheetGridView()
  21.         {
  22.         }
  23.         #region 类SheetGridView成员
  24.         private string _DataField = null;
  25.         [Browsable(true), Category("WorkSheet"), DefaultValue("")]
  26.         [Editor(typeof(DataSelector), typeof(UITypeEditor))]
  27.         public string DataField
  28.         {
  29.             get
  30.             {
  31.                 return this._DataField;
  32.             }
  33.             set
  34.             {
  35.                 this._DataField = value;
  36.             }
  37.         }
  38.         private bool _AutoRender = true;
  39.         [Category("WorkSheet"), DefaultValue(true)]
  40.         public bool AutoRender
  41.         {
  42.             get
  43.             {
  44.                 return this._AutoRender;
  45.             }
  46.             set
  47.             {
  48.                 this._AutoRender = value;
  49.             }
  50.         }
  51.         #endregion
  52.         #region ISheetControl 成员
  53.         public virtual void LoadDataField(OThinker.H3.WorkSheet.SheetPage SheetPage)
  54.         {
  55.             if (this.DataField == null || this.DataField == "")
  56.             {
  57.             }
  58.             else if (SheetPage.Enviroment.InstanceData[this.DataField] == null)
  59.             {
  60.             }
  61.             else if (SheetPage.Enviroment.InstanceData[this.DataField].Visible == false)
  62.             {
  63.                 this.Visible = false;
  64.             }
  65.             else if (SheetPage.Enviroment.InstanceData[this.DataField].Value == null)
  66.             {
  67.             }
  68.             else
  69.             {
  70.                 this.DataSource = SheetPage.Enviroment.InstanceData[this.DataField].Value;
  71.                 this.DataBind();
  72.             }
  73.         }
  74.         public virtual bool ValidateDataField(OThinker.H3.WorkSheet.SheetPage SheetPage, System.Collections.Generic.List<string> Errors)
  75.         {
  76.             return true;
  77.         }
  78.         public virtual void SaveDataField(OThinker.H3.WorkSheet.SheetPage SheetPage)
  79.         {
  80.             
  81.         }
  82.         #endregion
  83.         protected override void Render(HtmlTextWriter writer)
  84.         {
  85.             if (this.AutoRender)
  86.             {
  87.                 this.Enabled = true;
  88.             }
  89.             base.Render(writer);
  90.         }
  91.     }
  92. }