Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
770
Not hiting breakpoint in AddAttributesToRender() Method, what is missing here
posted

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[

 

DefaultProperty("Text"

)]

[

 

ToolboxData("<{0}:SNDTextBox runat=server></{0}:SNDTextBox>"

)]

 

 

public class SNDTextBox : WebTextEdit

{

 

 

 

public

SNDTextBox()

{

 

 

if (Roles

.Enabled)

{

 

 

if (Roles.IsUserInRole("View"

))

{

 

 

this.Enabled = false

;

}

}

}

 

[

 

Bindable(true

)]

[

 

Category(" Custom Properties"

)]

[

 

DefaultValue(false

)]

[

 

Localizable(true

)]

 

 

 

public bool

Mandatory

{

 

 

get

{

 

 

if (ViewState["Mandatory"] != null

)

{

 

 

bool s = (bool)ViewState["Mandatory"

];

 

 

return

s;

}

 

 

else

{

 

 

return false

;

}

}

 

 

set

{

ViewState[

 

"Mandatory"] = value

;

}

 

 

}

 

  

[System.Security.Permissions.

 

PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust"

)]

 

 

protected override void AddAttributesToRender(HtmlTextWriter

writer)

{

 

 

if

(Mandatory)

{

writer.AddAttribute(

 

"Mandatory", Mandatory.ToString(), true

);

}

 

 

base

.AddAttributesToRender(writer);

Parents
No Data
Reply
  • 24497
    posted

    Hi Sai,

    That is correct. Majority of controls in Infragistics.WebUI do not use that feature of WebControl. There are several reasons for that.

    Rendering is performed by following call 

    protected override void Render(HtmlTextWriter output)
    {
     ...
     this.GetRenderer().Render(output);
    }
    Where GetRender() returns renderer for specific state of user machine (UpLevel or DownLevel). That renderer renders explicitly to HtmlTextWriter all tags, attributes, scripts, hidden fields, etc..

    Those "renderer" classes and members are private, so, extended classes can not modify them and their logic.

    Note: custom attributes are rendered by something like

    System.Web.UI.AttributeCollection attrs = this.owner.Attributes;
    foreach(string key in attrs.Keys)
    {
     this.w(" ");
     this.w(key);
     this.w("=\"");
     this.w(attrs[key]);
     this.w("\"");
    }
    where w is call to output.Write...

Children