public AddDataControlFieldDialog(DataBoundControlDesigner controlDesigner) : base(controlDesigner.Component.Site) { this.fieldControlTop = 0x33; this._controlDesigner = controlDesigner; this.IgnoreRefreshSchemaEvents(); this.InitForm(); }
private bool SetDataSourceIDCallback(object context) { string str = (string)context; DataBoundControlDesigner designer = this._controlDesigner as DataBoundControlDesigner; if (designer != null) { TypeDescriptor.GetProperties(designer.Component)["DataSourceID"].SetValue(designer.Component, str); } else { BaseDataListDesigner designer2 = this._controlDesigner as BaseDataListDesigner; if (designer2 != null) { TypeDescriptor.GetProperties(designer2.Component)["DataSourceID"].SetValue(designer2.Component, str); } else { RepeaterDesigner designer3 = this._controlDesigner as RepeaterDesigner; if (designer3 != null) { TypeDescriptor.GetProperties(designer3.Component)["DataSourceID"].SetValue(designer3.Component, str); } } } return(true); }
public DataControlFieldsEditor(DataBoundControlDesigner controlDesigner) : base(controlDesigner.Component.Site) { this._controlDesigner = controlDesigner; this.InitializeComponent(); this.InitForm(); this._initialActivate = true; this.IgnoreRefreshSchemaEvents(); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { DataBoundControl dataBoundControl = context.Instance as DataBoundControl; if (dataBoundControl != null) { IDesignerHost service = (IDesignerHost)provider.GetService(typeof(IDesignerHost)); DataBoundControlDesigner designer = (DataBoundControlDesigner)service.GetDesigner(dataBoundControl); IComponentChangeService changeService = (IComponentChangeService)provider.GetService(typeof(IComponentChangeService)); ControlDesigner.InvokeTransactedChange(dataBoundControl, delegate(object callbackContext) { DataControlFieldsEditor form = new DataControlFieldsEditor(designer); DialogResult result = UIServiceHelper.ShowDialog(provider, form); if ((result == DialogResult.OK) && (changeService != null)) { changeService.OnComponentChanged(dataBoundControl, null, null, null); } return(result == DialogResult.OK); }, null, System.Design.SR.GetString("GridView_EditFieldsTransaction")); return(value); } return(null); }
public DataControlFieldDesignerControl(DataBoundControlDesigner controlDesigner, IServiceProvider serviceProvider, DataControlFieldDesigner designer, IDataSourceFieldSchema[] fieldSchemas, System.Type controlType) : base(fieldSchemas, controlType) { this._controlDesigner = controlDesigner; this._serviceProvider = serviceProvider; this._designer = designer; this.Initialize(); }
private string[] GetControlDataFieldNames() { if (this._dataFields == null) { ITypeDescriptorContext context = this.editor.Context; IDataSourceFieldSchema[] fields = null; IDataSourceViewSchema dataSourceViewSchema = null; if ((context != null) && (context.Instance != null)) { System.Web.UI.Control instance = context.Instance as System.Web.UI.Control; if (instance != null) { ISite site = instance.Site; if (site != null) { IDesignerHost host = (IDesignerHost)site.GetService(typeof(IDesignerHost)); if (host != null) { DataBoundControlDesigner designer = host.GetDesigner(instance) as DataBoundControlDesigner; if (designer != null) { DesignerDataSourceView designerView = designer.DesignerView; if (designerView != null) { try { dataSourceViewSchema = designerView.Schema; } catch (Exception exception) { IComponentDesignerDebugService service = (IComponentDesignerDebugService)site.GetService(typeof(IComponentDesignerDebugService)); if (service != null) { service.Fail(System.Design.SR.GetString("DataSource_DebugService_FailedCall", new object[] { "DesignerDataSourceView.Schema", exception.Message })); } } } } } } } else { IDataSourceViewSchemaAccessor accessor = context.Instance as IDataSourceViewSchemaAccessor; if (accessor != null) { dataSourceViewSchema = accessor.DataSourceViewSchema as IDataSourceViewSchema; } } } if (dataSourceViewSchema != null) { fields = dataSourceViewSchema.GetFields(); if (fields != null) { int length = fields.Length; this._dataFields = new string[length]; for (int i = 0; i < length; i++) { this._dataFields[i] = fields[i].Name; } } } } return(this._dataFields); }