09/07/27 20:19:11
>>686
UserControl、ReadOnlyプロパティから考えるにサーバコントロールじゃないの?
そもそもClientでValidationを行うのが間違いだし
超簡単にやるなら、こんなでいいんじゃない。
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label" Visible="False"></asp:Label>
public partial class WebUserControl : System.Web.UI.UserControl
{
public bool ReadOnly
{
get { return this.Label1.Visible; }
set
{
this.Label1.Visible = value;
this.TextBox1.Visible = !value;
}
}
public string Text
{
get { return this.Label1.Text; }
set
{
this.Label1.Text = value;
this.TextBox1.Text = value;
}
}
}