Z
Zürcher See
Who can explain me why this very simple UserControl with the "Document"
property, when is in a WebForm, I can't see/set the "Document" property from
the Properties Frame of VisualStudio?
WebUserControl1.ascx
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="WebUserControl1.ascx.cs"
Inherits="WebApplication1.WebUserControl1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<asp:Label id="Label1" runat="server">Label</asp:Label>
WebUserControl1.ascx.cs
sing System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
namespace WebApplication1
{
/// <summary>
/// Summary description for WebUserControl1.
/// </summary>
public class WebUserControl1 : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Label Label1;
private string _document;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
this.Label1.Text=Document;
}
[Category("Misc"),Browsable(true)]
public string Document
{
get{if (this._document!=null) return this._document; else return "";}
set{this._document=value;}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
property, when is in a WebForm, I can't see/set the "Document" property from
the Properties Frame of VisualStudio?
WebUserControl1.ascx
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="WebUserControl1.ascx.cs"
Inherits="WebApplication1.WebUserControl1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<asp:Label id="Label1" runat="server">Label</asp:Label>
WebUserControl1.ascx.cs
sing System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
namespace WebApplication1
{
/// <summary>
/// Summary description for WebUserControl1.
/// </summary>
public class WebUserControl1 : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Label Label1;
private string _document;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
this.Label1.Text=Document;
}
[Category("Misc"),Browsable(true)]
public string Document
{
get{if (this._document!=null) return this._document; else return "";}
set{this._document=value;}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}