View Full Version : [CLOSED] Inheriting from Ext Component HTML property

Jan 20, 2015, 7:54 PM
I created a custom control that inherits from Ext.Net.Component. The control simply overrides the Html property to allow for HtmlEncoding for XSS prevention. I notice that with a normal Ext.Net.Component, when you update Html property during a direct event, it sends back script to update the UI. With my custom control, it doesn't. What governs that? Do I need to specify the same property attributes as in the base class?

my Custom control:

Public Class SafeComponent
Inherits Ext.Net.Component

Public Property DisableEncoding As Boolean

Public Overrides Property Html As String
Return MyBase.Html
End Get
Set(value As String)
MyBase.Html = If(Me.DisableEncoding, value, System.Web.HttpUtility.HtmlEncode(value))
End Set
End Property
End Class

Base class Html property

[Description("An HTML fragment, or a DomHelper specification to use as the layout element content (defaults to '')")]
[DirectEventUpdate(MethodName = "Update")]
[Category("3. AbstractComponent")]
public virtual string Html
return this.State.Get<string>("Html", "");
this.State.Set("Html", (object) value);

Jan 21, 2015, 12:43 PM
Hi @jchau,

When a property is updated during a DirectEvent or a DirectEvent, Ext.NET is looking for a DirectEventUpdate attribute.

[DirectEventUpdate(MethodName = "Update")]

If defined, it calls a method specified in the attribute. The method is supposed to generate some JavaScript code to update a property on client side.