[CLOSED] Inheriting from Ext Component HTML property

  1. #1

    [CLOSED] Inheriting from Ext Component HTML property

    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
                Get
                    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
    [Meta]
        [Description("An HTML fragment, or a DomHelper specification to use as the layout element content (defaults to '')")]
        [DirectEventUpdate(MethodName = "Update")]
        [ConfigOption("html")]
        [Category("3. AbstractComponent")]
        [DefaultValue("")]
        [NotifyParentProperty(true)]
        public virtual string Html
        {
          get
          {
            return this.State.Get<string>("Html", "");
          }
          set
          {
            this.State.Set("Html", (object) value);
          }
        }
    Last edited by Daniil; Jan 30, 2015 at 1:44 PM. Reason: [CLOSED]
  2. #2
    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.

Similar Threads

  1. Replies: 0
    Last Post: Jul 31, 2013, 3:23 AM
  2. Replies: 8
    Last Post: Feb 06, 2013, 6:27 PM
  3. Replies: 2
    Last Post: Nov 03, 2011, 5:24 PM
  4. [CLOSED] How to add Guid[] property to the component?
    By pil0t in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 22, 2011, 2:23 PM
  5. [CLOSED] how to set panel html property as javascript property
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 05, 2011, 6:45 PM

Posting Permissions