T
Tomasz J
Hello Developers,
I have a control derived from System.Web.UI.WebControls.WebControl. Control
has this property:
[Bindable(true), Category("Misc"), Description("value")]
public string Value
{
set { _value = value; }
get { return _value; }
}
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
base.AddAttributesToRender(writer);
writer.AddAttribute("alt", _value);
}
I use my control like this:
<mc:MyControl ID="MyControl" Value="<%=Value %>" runat="server" />
(the page class has protected Value property)
There are no compilation problems, but ASP.Net incorrectly renders alt
attribute:
alt="<%=Value %>"
It seems like it is a problem at compile-time. I cannot use expressions in
control attribute values.
What could be wrong with this picture?
Any hints highly appreciated.
Tomasz J
I have a control derived from System.Web.UI.WebControls.WebControl. Control
has this property:
[Bindable(true), Category("Misc"), Description("value")]
public string Value
{
set { _value = value; }
get { return _value; }
}
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
base.AddAttributesToRender(writer);
writer.AddAttribute("alt", _value);
}
I use my control like this:
<mc:MyControl ID="MyControl" Value="<%=Value %>" runat="server" />
(the page class has protected Value property)
There are no compilation problems, but ASP.Net incorrectly renders alt
attribute:
alt="<%=Value %>"
It seems like it is a problem at compile-time. I cannot use expressions in
control attribute values.
What could be wrong with this picture?
Any hints highly appreciated.
Tomasz J