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


C# WebControls.DetailsView类代码示例

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


DetailsView类属于System.Web.UI.WebControls命名空间,在下文中一共展示了DetailsView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Export

 public static void Export(DetailsView dvGetStudent)
 {
     int rows = dvGetStudent.Rows.Count;
     int columns = dvGetStudent.Rows[0].Cells.Count;
     int pdfTableRows = rows;
     iTextSharp.text.Table PdfTable = new iTextSharp.text.Table(2, pdfTableRows);
     PdfTable.BorderWidth = 1;
     PdfTable.Cellpadding = 0;
     PdfTable.Cellspacing = 0;
     for (int rowCounter = 0; rowCounter < rows; rowCounter++)
     {
         for (int columnCounter = 0; columnCounter < columns; columnCounter++)
         {
             string strValue = dvGetStudent.Rows[rowCounter].Cells[columnCounter].Text;
             PdfTable.AddCell(strValue);
         }
     }
     Document Doc = new Document();
     PdfWriter.GetInstance(Doc, HttpContext.Current.Response.OutputStream);
     Doc.Open();
     Doc.Add(PdfTable);
     Doc.Close();
     HttpContext.Current.Response.ContentType = "application/pdf";
     HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=StudentDetails.pdf");
     HttpContext.Current.Response.End();
 }
开发者ID:an-kir,项目名称:List-Of-Students,代码行数:26,代码来源:ExportToPdf.cs

示例2: Export

        public static void Export(DetailsView dvGetStudent, string imageFilePath, string filename)
        {
            int rows = dvGetStudent.Rows.Count;
            int columns = dvGetStudent.Rows[0].Cells.Count;
            int pdfTableRows = rows - 1;
            iTextSharp.text.Table PdfTable = new iTextSharp.text.Table(2, pdfTableRows);
            //PdfTable.BorderWidth = 1;
            PdfTable.Cellpadding = 0;
            PdfTable.Cellspacing = 0;
            iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageFilePath);
            jpg.Alignment = Element.ALIGN_CENTER;
            jpg.ScaleToFit(150f, 150f);
            string fontUrl = System.AppDomain.CurrentDomain.BaseDirectory + "Files\\arial.ttf";
            BaseFont STF_Helvetica_Russian = BaseFont.CreateFont(fontUrl, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            Font font = new Font(STF_Helvetica_Russian, Font.DEFAULTSIZE, Font.NORMAL);
            for (int rowCounter = 1; rowCounter < rows; rowCounter++)
            {
                for (int columnCounter = 0; columnCounter < columns; columnCounter++)
                {
                    string strValue = dvGetStudent.Rows[rowCounter].Cells[columnCounter].Text;

                    PdfTable.AddCell(new Paragraph(strValue, font));
                }
            }
            Document Doc = new Document();

            PdfWriter.GetInstance(Doc, HttpContext.Current.Response.OutputStream);
            Doc.Open();
            Doc.Add(jpg);
            Doc.Add(PdfTable);
            Doc.Close();
            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + filename + ".pdf");
            HttpContext.Current.Response.End();
        }
开发者ID:an-kir,项目名称:List-Of-Students,代码行数:35,代码来源:ExportToPdf.cs

示例3: CoalesceBadges

        protected string CoalesceBadges(DetailsView dv)
        {
            var gv = (GridView)dv.FindControl("gvBadgeMembership");
            string badgesList= string.Empty;
            foreach(GridViewRow row in gv.Rows) {
                if(((CheckBox)row.FindControl("isMember")).Checked) {
                    badgesList = string.Format("{0},{1}", badgesList, ((Label)row.FindControl("BID")).Text);
                }
            }
            if(badgesList.Length > 0)
                badgesList = badgesList.Substring(1, badgesList.Length - 1);

            return badgesList;
        }
开发者ID:Lechlak,项目名称:greatreadingadventure,代码行数:14,代码来源:AwardAddEdit.aspx.cs

示例4: SetDataObject

        public void SetDataObject(object dataObject, DetailsView detailsView) {

            DataObject = dataObject;
            TypeDescriptionProvider typeDescriptionProvider;

            CustomTypeDescriptor = dataObject as ICustomTypeDescriptor;
            Type dataObjectType;

            if (CustomTypeDescriptor == null) {
                dataObjectType = dataObject.GetType();
                typeDescriptionProvider = TypeDescriptor.GetProvider(DataObject);
                CustomTypeDescriptor = typeDescriptionProvider.GetTypeDescriptor(DataObject);
            }
            else {
                dataObjectType = GetEntityType();
                typeDescriptionProvider = new TrivialTypeDescriptionProvider(CustomTypeDescriptor);
            }

            // Set the context type and entity set name on ourselves. Note that in this scenario those
            // concepts are somewhat artificial, since we don't have a real context. 

            // Set the ContextType to the dataObjectType, which is a bit strange but harmless
            Type contextType = dataObjectType;

            ((IDynamicDataSource)this).ContextType = contextType;

            // We can set the entity set name to anything, but using the
            // DataObjectType makes some Dynamic Data error messages clearer.
            ((IDynamicDataSource)this).EntitySetName = dataObjectType.Name;

            MetaModel model = null;
            try {
                model = MetaModel.GetModel(contextType);
            }
            catch {
                model = new MetaModel();
                model.RegisterContext(
                    new SimpleModelProvider(contextType, dataObjectType, dataObject),
                    new ContextConfiguration() {
                        MetadataProviderFactory = (type => typeDescriptionProvider)
                    });
            }

            MetaTable table = model.GetTable(dataObjectType);

            if (detailsView != null) {
                detailsView.RowsGenerator = new AdvancedFieldGenerator(table, false);
            }
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:49,代码来源:SimpleDynamicDataSource.cs

示例5: 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

示例6: CreateChildControls

        protected override void CreateChildControls()
        {
            _detailsView = new DetailsView
            {
                ID = string.Format("{0}_detailsView", base.ID),
                AutoGenerateRows = false,
                AllowPaging = true
            };

            //Set Paging Events
            _detailsView.PageIndexChanging += DetailsView_PageIndexChanging;

            //Create Custom Field
            var customField = new TemplateField
            {
                HeaderTemplate = new SetTemplate(DataControlRowType.Header, "Name"),
                ItemTemplate = new SetTemplate(DataControlRowType.DataRow)
            };

            //Add custom field to detailsview field
            _detailsView.Fields.Add(customField);

            //Create Bound Field
            var boundField = new BoundField
            {
                DataField = "PhoneNumber",
                HeaderText = "Phone Number",
            };

            //Set header font to bold
            boundField.HeaderStyle.Font.Bold = true;

            //Add bound field to detailsview field
            _detailsView.Fields.Add(boundField);

            //Bind Details View
            DetailsView_DataBind();

            //Add detaisview to composite control
            Controls.Add(_detailsView);
        }
开发者ID:WolfersCN,项目名称:Custom-DetailsView-Control,代码行数:41,代码来源:DetailsViewControl.cs

示例7: DetailsView_GetPostBackOptions_Null_Argument

		public void DetailsView_GetPostBackOptions_Null_Argument () {
			DetailsView dv = new DetailsView ();
			dv.Page = new Page ();
			PostBackOptions options = ((IPostBackContainer) dv).GetPostBackOptions (null);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:5,代码来源:DetailsViewTest.cs

示例8: DetailsView_GetPostBackOptions

		public void DetailsView_GetPostBackOptions () {
			DetailsView dv = new DetailsView ();
			dv.Page = new Page ();
			IButtonControl btn = new Button ();
			btn.CausesValidation = false;
			Assert.IsFalse (btn.CausesValidation, "DetailsView_GetPostBackOptions #1");
			Assert.AreEqual (String.Empty, btn.CommandName, "DetailsView_GetPostBackOptions #2");
			Assert.AreEqual (String.Empty, btn.CommandArgument, "DetailsView_GetPostBackOptions #3");
			Assert.AreEqual (String.Empty, btn.PostBackUrl, "DetailsView_GetPostBackOptions #4");
			Assert.AreEqual (String.Empty, btn.ValidationGroup, "DetailsView_GetPostBackOptions #5");
			PostBackOptions options = ((IPostBackContainer) dv).GetPostBackOptions (btn);
			Assert.IsFalse (options.PerformValidation, "DetailsView_GetPostBackOptions #6");
			Assert.IsFalse (options.AutoPostBack, "DetailsView_GetPostBackOptions #7");
			Assert.IsFalse (options.TrackFocus, "DetailsView_GetPostBackOptions #8");
			Assert.IsTrue (options.ClientSubmit, "DetailsView_GetPostBackOptions #9");
			Assert.IsTrue (options.RequiresJavaScriptProtocol, "DetailsView_GetPostBackOptions #10");
			Assert.AreEqual ("$", options.Argument, "DetailsView_GetPostBackOptions #11");
			Assert.AreEqual (null, options.ActionUrl, "DetailsView_GetPostBackOptions #12");
			Assert.AreEqual (null, options.ValidationGroup, "DetailsView_GetPostBackOptions #13");

			btn.ValidationGroup = "VG";
			btn.CommandName = "CMD";
			btn.CommandArgument = "ARG";
			btn.PostBackUrl = "Page.aspx";
			Assert.IsFalse (btn.CausesValidation, "DetailsView_GetPostBackOptions #14");
			Assert.AreEqual ("CMD", btn.CommandName, "DetailsView_GetPostBackOptions #15");
			Assert.AreEqual ("ARG", btn.CommandArgument, "DetailsView_GetPostBackOptions #16");
			Assert.AreEqual ("Page.aspx", btn.PostBackUrl, "DetailsView_GetPostBackOptions #17");
			Assert.AreEqual ("VG", btn.ValidationGroup, "DetailsView_GetPostBackOptions #18");
			options = ((IPostBackContainer) dv).GetPostBackOptions (btn);
			Assert.IsFalse (options.PerformValidation, "DetailsView_GetPostBackOptions #19");
			Assert.IsFalse (options.AutoPostBack, "DetailsView_GetPostBackOptions #20");
			Assert.IsFalse (options.TrackFocus, "DetailsView_GetPostBackOptions #21");
			Assert.IsTrue (options.ClientSubmit, "DetailsView_GetPostBackOptions #22");
			Assert.IsTrue (options.RequiresJavaScriptProtocol, "DetailsView_GetPostBackOptions #23");
			Assert.AreEqual ("CMD$ARG", options.Argument, "DetailsView_GetPostBackOptions #24");
			Assert.AreEqual (null, options.ActionUrl, "DetailsView_GetPostBackOptions #25");
			Assert.AreEqual (null, options.ValidationGroup, "DetailsView_GetPostBackOptions #26");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:39,代码来源:DetailsViewTest.cs

示例9: DetailsView_GetPostBackOptions_CausesValidation

		public void DetailsView_GetPostBackOptions_CausesValidation () {
			DetailsView dv = new DetailsView ();
			dv.Page = new Page ();
			IButtonControl btn = new Button ();
			Assert.IsTrue (btn.CausesValidation);
			Assert.AreEqual (String.Empty, btn.CommandName);
			Assert.AreEqual (String.Empty, btn.CommandArgument);
			Assert.AreEqual (String.Empty, btn.PostBackUrl);
			Assert.AreEqual (String.Empty, btn.ValidationGroup);
			PostBackOptions options = ((IPostBackContainer) dv).GetPostBackOptions (btn);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:11,代码来源:DetailsViewTest.cs

示例10: LocalizeDetailsView

 /// <summary>
 /// Localizes headers and fields on a DetailsView control
 /// </summary>
 /// <param name="detailsView"></param>
 /// <param name="resourceFile">The root name of the resource file where the localized
 ///  texts can be found</param>
 /// <remarks></remarks>
 public static void LocalizeDetailsView(ref DetailsView detailsView, string resourceFile)
 {
     foreach (DataControlField field in detailsView.Fields)
     {
         LocalizeDataControlField(field, resourceFile);
     }
 }
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:14,代码来源:Localization.cs

示例11: DetailsView_CurrentMode

		public void DetailsView_CurrentMode () {
			DetailsView view = new DetailsView ();
			view.DefaultMode = DetailsViewMode.Insert;
			Assert.AreEqual (DetailsViewMode.Insert, view.CurrentMode, "DetailsView_CurrentMode#1");
			view.ChangeMode (DetailsViewMode.Edit);
			Assert.AreEqual (DetailsViewMode.Edit, view.CurrentMode, "DetailsView_CurrentMode#2");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:7,代码来源:DetailsViewTest.cs

示例12: RedirectAfterUpdate

		/// <summary>
		/// Redirects the client to a new URL after the ItemUpdated event
		/// of the <see cref="DetailsView"/> object has been raised.
		/// </summary>
		/// <param name="view">A <see cref="DetailsView"/> object.</param>
		/// <param name="url">The target location.</param>
		public static void RedirectAfterUpdate(DetailsView view, String url)
		{
			RedirectAfterUpdate(view, url, null);
		}
开发者ID:pratik1988,项目名称:VedicKart,代码行数:10,代码来源:FormUtilBase.generated.cs

示例13: 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

示例14: RedirectAfterUpdateCancel

		/// <summary>
		/// Redirects the client to a new URL after the ItemUpdated event of the <see cref="DetailsView"/>
		/// has been raised or after the ItemCommand event of the <see cref="DetailsView"/> object has
		/// been raised with a CommandName of "Cancel".
		/// </summary>
		/// <param name="view">A <see cref="DetailsView"/> object.</param>
		/// <param name="grid">A <see cref="GridView"/> object.</param>
		/// <param name="url">The target location.</param>
		public static void RedirectAfterUpdateCancel(DetailsView view, GridView grid, String url)
		{
			url = GetRedirectUrl(grid, url);
			RedirectAfterUpdateCancel(view, url);
		}
开发者ID:pratik1988,项目名称:VedicKart,代码行数:13,代码来源:FormUtilBase.generated.cs

示例15: RedirectAfterInsertUpdateCancel

		/// <summary>
		/// Redirects the client to a new URL after the ItemInserted or ItemUpdated event of the <see cref="DetailsView"/>
		/// has been raised or after the ItemCommand event of the <see cref="DetailsView"/> object has
		/// been raised with a CommandName of "Cancel".
		/// </summary>
		/// <param name="view">A <see cref="DetailsView"/> object.</param>
		/// <param name="url">The target location.</param>
		public static void RedirectAfterInsertUpdateCancel(DetailsView view, String url)
		{
			RedirectAfterInsertUpdateCancel(view, url, null);
		}
开发者ID:pratik1988,项目名称:VedicKart,代码行数:11,代码来源:FormUtilBase.generated.cs


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