如何設置文本的默認值爲「abc」?Web用戶控制設置默認值
public enum MessageType
{
Good,
Bad
}
public partial class Message : System.Web.UI.UserControl
{
public bool Visible { get; set; } // Is the error visible
public string Text { get; set; } // Text of the error message
public MessageType Type { get; set; } // Message type
protected void Page_Load(object sender, EventArgs e)
{
ErrorPanel.Visible = this.Visible;
ErrorMsg.Text = this.Text;
// Hide if nothing to display
if (this.Text == null)
this.Visible = false;
// Set correct CSS class
if (this.Type == MessageType.Good)
ErrorPanel.CssClass = "good-box";
else
ErrorPanel.CssClass = "bad-box";
}
}
這個工作嗎? – V4Vendetta 2011-04-11 09:49:05
似乎對我從它複製的用戶控件起作用。在設計器中將值設置爲默認值,並且如果以粗體突出顯示更改 – WraithNath 2011-04-11 09:49:59