private String GenEFDataSource(TBlockFieldItem FieldItem, String TableName, String Kind, String ExtraName) { String Name = "EFDS" + TableName + FieldItem.DataField + ExtraName; bool isExist = false; foreach (EFClientTools.Web.EFDataSource bWebDataSource in FEFDataSourceList) { if (String.Compare(bWebDataSource.ID, Name) == 0) { isExist = true; break; } } #if VS90 object oDataSource = FDesignerDocument.webControls.item(Name, 0); if (oDataSource != null && oDataSource is WebDevPage.IHTMLElement) { WebDevPage.IHTMLElement eDataSoruce = oDataSource as WebDevPage.IHTMLElement; if (eDataSoruce.tagName.ToLower() == "efclienttools:efdatasource") return Name; } WebDevPage.IHTMLElement div = ((WebDevPage.IHTMLElementCollection)FDesignerDocument.pageContentElement.children).item("div1", 0) as WebDevPage.IHTMLElement; if (Kind == "ComboBox") { if (!isExist) { EFClientTools.Web.EFDataSource aEFDataSource = new EFClientTools.Web.EFDataSource(); aEFDataSource.ID = Name; aEFDataSource.RemoteName = FieldItem.ComboRemoteName; aEFDataSource.DataMember = FieldItem.ComboEntityName; aEFDataSource.Active = true; FEFDataSourceList.Add(aEFDataSource); WebDevPage.IHTMLElement Page = FDesignerDocument.pageContentElement; InsertControl(Page, aEFDataSource); //div.insertAdjacentHTML("afterBegin", "<EFClientTools:EFDataSource ID=\"" + Name + "\" runat=\"server\" RemoteName=\"" + aWebDataSource.RemoteName + // "\" DataMember=\"" + aWebDataSource.DataMember + "\" Active=\"True\"></EFClientTools:EFDataSource>"); } } return Name; #endif }
private void GenDataSet() { #if VS90 object oExtLayout = FDesignerDocument.webControls.item("ExtLayout1", 0); if (oExtLayout != null && oExtLayout is WebDevPage.IHTMLElement) { ((WebDevPage.IHTMLElement)oExtLayout).setAttribute("Title", FClientData.FormTitle, 0); } object oEFDSMaster = FDesignerDocument.webControls.item("EFDSMaster", 0); if (oEFDSMaster != null && oEFDSMaster is WebDevPage.IHTMLElement) { ((WebDevPage.IHTMLElement)oEFDSMaster).setAttribute("RemoteName", FClientData.RemoteName, 0); ((WebDevPage.IHTMLElement)oEFDSMaster).setAttribute("DataMember", FClientData.EntityName, 0); ((WebDevPage.IHTMLElement)oEFDSMaster).setAttribute("Active", "True", 0); } object oEFDSDetail = FDesignerDocument.webControls.item("EFDSDetail", 0); if (oEFDSDetail != null && oEFDSDetail is WebDevPage.IHTMLElement) { ((WebDevPage.IHTMLElement)oEFDSDetail).setAttribute("RemoteName", FClientData.RemoteName, 0); EFClientTools.Web.EFDataSource aEFDataSource = new EFClientTools.Web.EFDataSource(); aEFDataSource.RemoteName = FClientData.RemoteName; aEFDataSource.DataMember = FClientData.EntityName; aEFDataSource.Active = true; ((WebDevPage.IHTMLElement)oEFDSDetail).setAttribute("DataMember", FClientData.DetailEntityName, 0); ((WebDevPage.IHTMLElement)oEFDSDetail).setAttribute("Active", "True", 0); } #endif }