[Mono-list] Bug within ASP.NET WebControls?
Pedro Santos
donbonifacio at gmail.com
Mon Feb 23 06:16:12 EST 2009
> Please don't use pastebin for mailing list posts, as those
> pastes usually expire too soon to be useful for other
> people looking for the same problem in the future.
Yes, you're right, didn't think of that.
BTW, I commented the following line:
text.CssClass = CssClass;
On my Render method, and the exception isn't thrown.
Here's the code:
public abstract class StringEditor<T> : BaseEntityFieldEditor<T> where
T : IDescriptable {
#region Fields & Properties
protected TextBox text = new TextBox();
public string Text
{
get { return text.Text; }
set { text.Text = value; }
}
public bool Enabled {
get { return text.Enabled; }
set { text.Enabled = value; }
}
public int Length {
get { return text.MaxLength; }
set { text.MaxLength = value; }
}
public bool ReadOnly {
get { return text.ReadOnly; }
set { text.ReadOnly = value; }
}
public TextBox TextBox {
get { return text; }
}
#endregion Fields & Properties
#region Events
protected override void OnInit( EventArgs args )
{
base.OnInit(args);
text.ID = TargetName;
Controls.Add(text);
}
protected override void Render( HtmlTextWriter writer, T t, int
renderCount, bool flipFlop )
{
text.CssClass = CssClass;
SetCaption(t);
foreach (Control control in Controls) {
control.RenderControl(writer);
}
}
private void SetCaption(T t)
{
if (Page.IsPostBack && !string.IsNullOrEmpty(text.Text)) {
// let's just use the post back value
return;
}
text.Text = GetCaption(t);
}
#endregion Events
#region Abstract Members
protected abstract string GetCaption( T t );
protected abstract string TargetName { get; }
#endregion
};
On Mon, Feb 23, 2009 at 11:10 AM, Robert Jordan <robertj at gmx.net> wrote:
> Pedro Santos wrote:
>> http://pastebin.com/m214a6c22
>
> Please don't use pastebin for mailing list posts, as those
> pastes usually expire too soon to be useful for other
> people looking for the same problem in the future.
>
> Robert
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
--
Pedro Santos
Home - http://psantos.zi-yu.com
Work - http://www.pdmfc.com
The future - http://www.orionsbelt.eu
More information about the Mono-list
mailing list