當前位置: 首頁>>代碼示例>>C#>>正文


C# WebControls.ObjectDataSource類代碼示例

本文整理匯總了C#中System.Web.UI.WebControls.ObjectDataSource的典型用法代碼示例。如果您正苦於以下問題:C# ObjectDataSource類的具體用法?C# ObjectDataSource怎麽用?C# ObjectDataSource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ObjectDataSource類屬於System.Web.UI.WebControls命名空間,在下文中一共展示了ObjectDataSource類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ObjectDataSourceChooseMethodsPanel

 public ObjectDataSourceChooseMethodsPanel(ObjectDataSourceDesigner objectDataSourceDesigner)
 {
     this._objectDataSourceDesigner = objectDataSourceDesigner;
     this.InitializeComponent();
     this.InitializeUI();
     this._objectDataSource = (ObjectDataSource) this._objectDataSourceDesigner.Component;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:ObjectDataSourceChooseMethodsPanel.cs

示例2: ObjectDataSourceConfigureParametersPanel

 public ObjectDataSourceConfigureParametersPanel(ObjectDataSourceDesigner objectDataSourceDesigner)
 {
     this._objectDataSourceDesigner = objectDataSourceDesigner;
     this._objectDataSource = (ObjectDataSource) this._objectDataSourceDesigner.Component;
     this.InitializeComponent();
     this.InitializeUI();
     this._parameterEditorUserControl.SetAllowCollectionChanges(false);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:8,代碼來源:ObjectDataSourceConfigureParametersPanel.cs

示例3: ObjectDataSourceWizardForm

 public ObjectDataSourceWizardForm(IServiceProvider serviceProvider, ObjectDataSourceDesigner objectDataSourceDesigner) : base(serviceProvider)
 {
     base.Glyph = new Bitmap(typeof(SqlDataSourceWizardForm), "datasourcewizard.bmp");
     this._objectDataSourceDesigner = objectDataSourceDesigner;
     this._objectDataSource = (ObjectDataSource) this._objectDataSourceDesigner.Component;
     this.Text = System.Design.SR.GetString("ConfigureDataSource_Title", new object[] { this._objectDataSource.ID });
     ObjectDataSourceChooseTypePanel panel = new ObjectDataSourceChooseTypePanel(this._objectDataSourceDesigner);
     ObjectDataSourceChooseMethodsPanel panel2 = new ObjectDataSourceChooseMethodsPanel(this._objectDataSourceDesigner);
     base.SetPanels(new WizardPanel[] { panel, panel2 });
     this._parametersPanel = new ObjectDataSourceConfigureParametersPanel(this._objectDataSourceDesigner);
     base.RegisterPanel(this._parametersPanel);
     base.Size += new Size(0, 40);
     this.MinimumSize = base.Size;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:14,代碼來源:ObjectDataSourceWizardForm.cs

示例4: CreateCommonDataSource

		public ObjectDataSource CreateCommonDataSource (String TypeName, String [] Parameter)
			{
			ObjectDataSource CommonDataSource = new ObjectDataSource ();
			String [] Entries = TypeName.Split ('.');
			int NumberOfEntries = Entries.Count ();
			String BasisSourceName = Entries [NumberOfEntries - 1];
			CommonDataSource.ID = BasisSourceName + "ID";
			CommonDataSource.TypeName = TypeName;

			CommonDataSource.SelectMethod = BasisSourceName + "Select";
			foreach (String Entry in Parameter)
				{
				CommonDataSource.SelectParameters.Add
					(new CVM.WebParameter
						(Entry, System.TypeCode.String, ""));
				}

			CommonDataSource.SelectMethod = BasisSourceName + "Insert";
			foreach (String Entry in Parameter)
				{
				CommonDataSource.SelectParameters.Add
					(new CVM.WebParameter
						(Entry, System.TypeCode.String, ""));
				}

			CommonDataSource.SelectMethod = BasisSourceName + "Edit";
			foreach (String Entry in Parameter)
				{
				CommonDataSource.SelectParameters.Add
					(new CVM.WebParameter
						(Entry, System.TypeCode.String, ""));
				}

			CommonDataSource.SelectMethod = BasisSourceName + "Delete";
			foreach (String Entry in Parameter)
				{
				CommonDataSource.SelectParameters.Add
					(new CVM.WebParameter
						(Entry, System.TypeCode.String, ""));
				}

			return CommonDataSource;
			}
開發者ID:heinzsack,項目名稱:DEV,代碼行數:43,代碼來源:DataSourceFuntions.cs

示例5: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Check if User is logged in
                if (string.IsNullOrEmpty(Session["UserID"] as string))
                {
                    //if user not logged in, redirect to Login page
                    Response.Redirect("Login.aspx");
                }
                ObjectDataSource labsDataSource = new ObjectDataSource();
                labsDataSource.TypeName = "ARMS_Project.LabLogic";
                labsDataSource.SelectMethod = "GetLabs";

                ddlLabID.DataSource = labsDataSource;
                ddlLabID.DataTextField = "name";
                ddlLabID.DataValueField = "id";
                ddlLabID.DataBind();
            }
        }
開發者ID:CIS4396-Arms,項目名稱:ARMS,代碼行數:20,代碼來源:AddSecondaryAntibody.aspx.cs

示例6: FillGridView

        private void FillGridView()
        {

            ObjectDataSource ods = new ObjectDataSource
                                       {
                                           ID = "ods" + _id,
                                           EnablePaging = _gv.AllowPaging,
                                           TypeName = "Site.Kids.bmi.ir.Classes.TableAdapter",
                                           SelectMethod = "GetData",
                                           SelectCountMethod = "VirtualItemCount",
                                           StartRowIndexParameterName = "startRow",
                                           MaximumRowsParameterName = "maxRows",
                                           EnableViewState = false
                                       };

            ods.ObjectCreating += new ObjectDataSourceObjectEventHandler(ods_ObjectCreating);

            _gv.DataSource = ods;
            _gv.DataBind();
        }
開發者ID:sinaaslani,項目名稱:kids.bmi.ir,代碼行數:20,代碼來源:GridViewPaging.cs

示例7: DoPaging

        public static void DoPaging(GridView gv, object dt, int VirtualItemCount)
        {
            ObjectDataSource ods = new ObjectDataSource
                                       {
                                           ID = "ods" + gv.ID,
                                           EnablePaging = gv.AllowPaging,
                                           TypeName = typeof (TableAdapter).FullName,
                                           SelectMethod = "GetData",
                                           SelectCountMethod = "VirtualItemCount",
                                           StartRowIndexParameterName = "startRow",
                                           MaximumRowsParameterName = "maxRows",
                                           EnableViewState = false
                                       };

            ods.ObjectCreating += new ObjectDataSourceObjectEventHandler(
                (sender, e) => { e.ObjectInstance = new TableAdapter(dt, VirtualItemCount); }
                );

            gv.DataSource = ods;
            gv.DataBind();
        }
開發者ID:sinaaslani,項目名稱:kids.bmi.ir,代碼行數:21,代碼來源:GridViewPaging.cs

示例8: Fill

        /// <summary>
        /// Fills the specified gridview with a page of data.
        /// </summary>
        /// <param name="gv">The gridview.</param>
        /// <param name="list">The single page of data.</param>
        /// <param name="count">The total count (to work out number of pages).</param>
        /// <param name="pageSize">Size of the page.</param>
        public static void Fill(System.Web.UI.WebControls.GridView gv, IList<object> list, int count, int pageSize)
        {
            //create an ObjectDateSource object programmatically
            ObjectDataSource ods = new ObjectDataSource();
            ods.ID = "ods" + gv.ID;           

            ods.EnablePaging = gv.AllowPaging;
            ods.TypeName = "ObjectAdaptor"; //can be a common base class
            ods.SelectMethod = "Select";
            ods.SelectCountMethod = "Count";
            ods.StartRowIndexParameterName = "startRowIndex";
            ods.MaximumRowsParameterName = "maximumRows";
            ods.EnableViewState = false;
            //when creating, inject the data into the table adaptor
            ods.ObjectCreating += delegate(object sender, ObjectDataSourceEventArgs e)
            { e.ObjectInstance = new ObjectAdaptor(list, count); };
            ods.DataBind();

            gv.PageSize = pageSize;
            gv.DataSource = ods;
            gv.DataBind();
        }
開發者ID:jackiechou,項目名稱:thegioicuaban.com,代碼行數:29,代碼來源:GridViewFiller.cs

示例9: ObjectDataSourceView

 public ObjectDataSourceView(ObjectDataSource owner, string name, System.Web.HttpContext context) : base (default(System.Web.UI.IDataSource), default(string))
 {
 }
開發者ID:asvishnyakov,項目名稱:CodeContracts,代碼行數:3,代碼來源:System.Web.UI.WebControls.ObjectDataSourceView.cs

示例10: FormView_DataKey

		public void FormView_DataKey ()
		{
			Page p = new Page ();

			Poker fv = new Poker ();
			p.Controls.Add (fv);

			ObjectDataSource data = new ObjectDataSource ();
			data.TypeName = typeof (FormViewDataObject).AssemblyQualifiedName;
			data.SelectMethod = "Select";
			p.Controls.Add (data);

			fv.DataSource = data;
			fv.DataKeyNames = new string [] { "ID", "FName" };

			DataKey key1 = fv.DataKey;

			Assert.AreEqual (null, key1.Value, "DataKey.Value before binding");
			Assert.AreEqual (0, key1.Values.Count, "DataKey.Values count before binding");

			fv.DataBind ();

			DataKey key2 = fv.DataKey;
			DataKey key3 = fv.DataKey;

			Assert.IsFalse (Object.ReferenceEquals (key1, key2), "DataKey returns the same instans");
			Assert.IsTrue (Object.ReferenceEquals (key2, key3), "DataKey returns the same instans");
			
			Assert.AreEqual (1001, key1.Value, "DataKey.Value after binding");
			Assert.AreEqual (2, key1.Values.Count, "DataKey.Values count after binding");
			Assert.AreEqual (1001, key1.Values [0], "DataKey.Values[0] after binding");
			Assert.AreEqual ("Mahesh", key1.Values [1], "DataKey.Values[1] after binding");

			Poker copy = new Poker ();
			object state = fv.DoSaveControlState ();
			copy.DoLoadControlState (state);

			DataKey key4 = copy.DataKey;

			Assert.AreEqual (1001, key4.Value, "DataKey.Value from ViewState");
			Assert.AreEqual (2, key4.Values.Count, "DataKey.Values count from ViewState");
			Assert.AreEqual (1001, key4.Values [0], "DataKey.Values[0] from ViewState");
			Assert.AreEqual ("Mahesh", key4.Values [1], "DataKey.Values[1] from ViewState");
		}
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:44,代碼來源:FormViewTest.cs

示例11: FormView_CreateDataSourceSelectArguments2

		public void FormView_CreateDataSourceSelectArguments2 () {
			DataSourceView view;
			Page p = new Page ();

			Poker dv = new Poker ();
			p.Controls.Add (dv);

			ObjectDataSource data = new ObjectDataSource ();
			data.TypeName = typeof (DataSourceObject).AssemblyQualifiedName;
			data.SelectMethod = "GetList";
			data.SortParameterName = "sortExpression";
			DataSourceSelectArguments arg;
			p.Controls.Add (data);

			dv.DataSource = data;
			dv.DataBind ();

			arg = dv.DoCreateDataSourceSelectArguments ();
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "Default");

			dv.AllowPaging = true;
			dv.PageIndex = 2;
			arg = dv.DoCreateDataSourceSelectArguments ();
			view = dv.DoGetData ();
			Assert.IsFalse (view.CanPage);
			Assert.IsTrue (view.CanRetrieveTotalRowCount);
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "AllowPaging = true, CanPage = false, CanRetrieveTotalRowCount = true");

			// make DataSourceView.CanPage = true
			data.EnablePaging = true;

			arg = dv.DoCreateDataSourceSelectArguments ();
			view = dv.DoGetData ();
			Assert.IsTrue (view.CanPage);
			Assert.IsFalse (view.CanRetrieveTotalRowCount);
			Assert.IsTrue (arg.Equals (new DataSourceSelectArguments (2, -1)), "AllowPaging = true, CanPage = true, CanRetrieveTotalRowCount = false");

			dv.AllowPaging = false;
			arg = dv.DoCreateDataSourceSelectArguments ();
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "AllowPaging = false, CanPage = true, CanRetrieveTotalRowCount = false");

			// make DataSourceView.CanRetrieveTotalRowCount = true
			data.SelectCountMethod = "GetCount";

			arg = dv.DoCreateDataSourceSelectArguments ();
			Assert.IsTrue (arg.Equals (DataSourceSelectArguments.Empty), "AllowPaging = false, CanPage = true, CanRetrieveTotalRowCount = true");

			dv.AllowPaging = true;
			arg = dv.DoCreateDataSourceSelectArguments ();
			DataSourceSelectArguments arg1 = new DataSourceSelectArguments (2, 1);
			arg1.RetrieveTotalRowCount = true;
			view = dv.DoGetData ();
			Assert.IsTrue (view.CanPage);
			Assert.IsTrue (view.CanRetrieveTotalRowCount);
			Assert.IsTrue (arg.Equals (arg1), "AllowPaging = true, CanPage = true, CanRetrieveTotalRowCount = true");
		}
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:56,代碼來源:FormViewTest.cs

示例12: PageCount

		public void PageCount ()
		{
			ObjectDataSource ds = new ObjectDataSource ();
			ds.ID = "ObjectDataSource1";
			ds.TypeName = "System.Guid";
			ds.SelectMethod = "ToByteArray";
			Page p = new Page ();
			Poker f = new Poker ();
			f.Page = p;
			ds.Page = p;
			p.Controls.Add (f);
			p.Controls.Add (ds);
			f.DataSourceID = "ObjectDataSource1";
			f.DoConfirmInitState ();
			f.DoOnPreRender (EventArgs.Empty);
			f.PageIndex = 1;
			Assert.AreEqual (16, f.PageCount, "#01");
		} 
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:18,代碼來源:FormViewTest.cs

示例13: initObjectDataSource

        private void initObjectDataSource(ObjectDataSource aODS,
            string DataObjectOperatorType,
            string DataObjectType,
            string SelectMethod,
            string InsertMethod,
            string UpdateMethod,
            string DeleteMethod,
            string SelectCountMethod)
        {
            aODS.ID = "ods";
            aODS.TypeName = DataObjectOperatorType;
            aODS.DataObjectTypeName = DataObjectType;

            aODS.SelectMethod = SelectMethod;
            aODS.InsertMethod = InsertMethod;
            aODS.UpdateMethod = UpdateMethod;
            aODS.DeleteMethod = DeleteMethod;
            aODS.SelectCountMethod = SelectCountMethod;

            aODS.OldValuesParameterFormatString = "original_{0}";
            aODS.EnablePaging = true;
            aODS.EnableViewState = false;

            aODS.SelectParameters.Add("startRowIndex", TypeCode.Int32, "0");
            aODS.SelectParameters.Add("maximumRows", TypeCode.Int32, "0");

            aODS.ObjectCreating += new ObjectDataSourceObjectEventHandler(DoObjectCreating);
        }
開發者ID:skt90u,項目名稱:skt90u-framework-dotnet,代碼行數:28,代碼來源:XGridView.cs

示例14: DetailsView_PageCount

		public void DetailsView_PageCount () {
			Page p = new Page ();

			PokerDetailsView gv = new PokerDetailsView ();
			p.Controls.Add (gv);

			ObjectDataSource data = new ObjectDataSource ();
			data.ID = "ObjectDataSource1";
			data.TypeName = typeof (TableObject).AssemblyQualifiedName;
			data.SelectMethod = "GetMyData";
			p.Controls.Add (data);

			gv.DataSourceID = "ObjectDataSource1";
			gv.DataKeyNames = new string [] { "ID", "FName" };
			gv.SetRequiresDataBinding (true);

			Assert.AreEqual (0, gv.PageCount, "PageCount before binding");

			gv.DataBind ();

			Assert.AreEqual (3, gv.PageCount, "PageCount after binding");

			//PokerDetailsView copy = new PokerDetailsView ();
			//object state = gv.SaveState ();
			//copy.LoadState (state);

			//Assert.AreEqual (3, copy.PageCount, "PageCount from ViewState");
		}
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:28,代碼來源:DetailsViewTest.cs

示例15: CanUpdate

		public void CanUpdate ()
		{
			ObjectDataSource ds = new ObjectDataSource ();
			ObjectViewPoker sql = new ObjectViewPoker (ds, "DefaultView", null);

			sql.UpdateMethod = "UpdateMethod";
			Assert.IsTrue (sql.CanUpdate, "A1");

			sql.UpdateMethod = "";
			Assert.IsFalse (sql.CanUpdate, "A2");

			sql.UpdateMethod = null;
			Assert.IsFalse (sql.CanUpdate, "A3");
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:14,代碼來源:ObjectDataSourceViewTest.cs


注:本文中的System.Web.UI.WebControls.ObjectDataSource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。