当前位置: 首页>>代码示例>>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;未经允许,请勿转载。