当前位置: 首页>>代码示例>>C#>>正文


C# DetailsView.DataBind方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.DetailsView.DataBind方法的典型用法代码示例。如果您正苦于以下问题:C# DetailsView.DataBind方法的具体用法?C# DetailsView.DataBind怎么用?C# DetailsView.DataBind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.DetailsView的用法示例。


在下文中一共展示了DetailsView.DataBind方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: grid_SelectedIndexChanged

        protected void grid_SelectedIndexChanged(Object sender, EventArgs e)
        {
            DetailsView details = new DetailsView();

            GridViewRow selectedRow = grid.SelectedRow;
            String title_id = selectedRow.Cells[1].Text;

            SqlCommand cmd = new SqlCommand("SELECT * from titles where titles.title_id='"+title_id+"';", con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);

            details.DataSource = ds;
            details.DataBind();
            details.Visible = true;
            details.CssClass = "table table-striped table-hover";
            PlaceHolder3.Controls.Add(details);
        }
开发者ID:luispedro18,项目名称:EDC2015-Trabalho1,代码行数:18,代码来源:BookList.aspx.cs

示例2: GetProjectDetails

        private DetailsView GetProjectDetails(UpdateType updateType)
        {
            DetailsView dvProjectDetails = new DetailsView();

            DataTable projectRecord = new DataTable();
            projectRecord.Columns.Add("ProjectId", typeof(Int32));
            projectRecord.Columns.Add("Description", typeof(String));
            DataRow dr = projectRecord.NewRow();
            dr["ProjectId"] = 3;
            dr["Description"] = "Test Project";
            projectRecord.Rows.Add(dr);

            dvProjectDetails.DataSource = projectRecord;
            dvProjectDetails.DataBind();

            switch (updateType)
            {
                case UpdateType.Insert:
                    dvProjectDetails.ChangeMode(DetailsViewMode.Insert);
                    break;
                case UpdateType.Update:
                    dvProjectDetails.ChangeMode(DetailsViewMode.Edit);
                    break;
                //case EditGatewaysPresenterFixture.UpdateType.View:
                //    dvProjectDetails.Rows(p.DetailColumns.PaymentTypeID).Cells[1].Controls.Add(Me.GetPaymentTypeIDLabel);
                //    break;
            }

            return dvProjectDetails;
        }
开发者ID:johnhilts,项目名称:HourEntry,代码行数:30,代码来源:ProjectPresenter.cs

示例3: EventsTest

		public static void EventsTest (Page p)
		{				
			
			MyTableObject.ds = MyTableObject.CreateDataTable ();  
			DetailsView dv = new DetailsView  ();
			ObjectDataSourcePoker ods = new ObjectDataSourcePoker ();
			ods.ObjectCreated += new ObjectDataSourceObjectEventHandler (odc_ObjectCreated);
			ods.ObjectCreating += new ObjectDataSourceObjectEventHandler (odc_ObjectCreating);
			InitObjectDataSource (ods,"");
			ods.FilterExpression = "ID='1001'";			
			dv.Page = p;
			ods.Page = p;
			dv.DataKeyNames = new string[] { "ID" };
			dv.DataSource = ods;
			p.Controls.Add (ods);
			p.Controls.Add (dv);
			dv.DataBind ();							
			ods.Filtering += new ObjectDataSourceFilteringEventHandler (odc_Filtering);
			Assert.AreEqual (false, filtering, "BeforeFilteringEvent");
			ods.Select ();
			Assert.AreEqual (true, filtering, "AfterFilteringEvent");
			ods.ObjectDisposing += new ObjectDataSourceDisposingEventHandler (odc_ObjectDisposing);
			//ToDo: Dispose, ObjectCreated and ObjectCreating should be tested.
			
		}
开发者ID:Profit0004,项目名称:mono,代码行数:25,代码来源:ObjectDataSourceTest.cs

示例4: cArchivoExcelHTMLPorRequerimientoDetalleGrilla

        public string cArchivoExcelHTMLPorRequerimientoDetalleGrilla(DetailsView objDetailView, string strNombreArchivo, Page objPage, string IdRequerimiento)
        {
            int intIdRequerimiento = int.Parse(IdRequerimiento);

            StringBuilder sb = new StringBuilder();

            #region Creamos la cabecera

            sb.Append(strCrearDocumentoExcelDetalleGrilla(objDetailView, intIdRequerimiento));

            #endregion

            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            Page page = new Page();
            HtmlForm form = new HtmlForm();

            #region Crea el Archivo Excel
            try
            {
                objDetailView.AllowPaging = false;
                objDetailView.DataBind();
                objDetailView.EnableViewState = false;

                page.EnableEventValidation = false;

                page.DesignerInitialize();
                page.Controls.Add(form);
                form.Controls.Add(objDetailView);

                page.RenderControl(htw);

                objPage.Response.Clear();
                objPage.Response.Buffer = true;
                objPage.Response.ContentType = "application/vnd.ms-excel";
                objPage.Response.AppendHeader("Content-Disposition", "attachment;filename=" + strNombreArchivo + "" + DateTime.Now.ToShortDateString() + ".xls");
                objPage.Response.Charset = "UTF-8";
                objPage.Response.ContentEncoding = System.Text.Encoding.Default;
                objPage.Response.Write(sb.ToString());
                objPage.Response.Flush();
                objPage.Response.Close();
                objPage.Response.End();

            }
            catch (Exception ex)
            {

                return "Error al crear Archivo Excel " + ": " + ex.ToString();
            }
            #endregion

            return "Por favor guardar el archivo Excel creado";
        }
开发者ID:jlaua,项目名称:WebHomologacion,代码行数:53,代码来源:cUtils.cs

示例5: DeleteMethod

		public static void DeleteMethod (Page p)
		{
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			MyTableObject.ds = MyTableObject.CreateDataTable ();  
			DetailsView dv = new DetailsView ();
			ObjectDataSourcePoker ods = new ObjectDataSourcePoker ();
			ods.Deleted += new ObjectDataSourceStatusEventHandler (odc_Deleted);
			ods.Deleting += new ObjectDataSourceMethodEventHandler (odc_Deleting);	
			InitObjectDataSource (ods,"");
			dv.Page = p;
			ods.Page = p;
			dv.DataKeyNames = new string[] { "ID" };
			dv.DataSource = ods;
			p.Controls.Add (lcb); 
			p.Controls.Add (ods);
			p.Controls.Add (dv);
			p.Controls.Add (lce); 
			dv.DataBind ();
			Assert.AreEqual (3, dv.DataItemCount, "BeforeDelete1");
			Assert.AreEqual (1001, dv.SelectedValue, "BeforeDelete2");
			Assert.AreEqual (false, deleting, "BeforeDeletingEvent");
			Assert.AreEqual (false, deleted, "BeforeDeletedEvent");
			ods.Delete ();			
			dv.DataBind ();
			Assert.AreEqual (true, deleting, "AfterDeletingEvent");
			Assert.AreEqual (true, deleted, "AfterDeletedEvent");
			Assert.AreEqual (2, dv.DataItemCount, "BeforeDelete1");
			Assert.AreEqual (1002, dv.SelectedValue, "BeforeDelete2");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:30,代码来源:ObjectDataSourceTest.cs


注:本文中的System.Web.UI.WebControls.DetailsView.DataBind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。