Professional Web Applications Themes

Adding Literal Controls in CreateChildControls - Is this bad? - ASP.NET Building Controls

Adding Literal Controls in CreateChildControls - Is this bad? Someone told me it was but every example I've seen does not have a problem doing it. They told me I should add the html to the page in the render method and add the control where I want them to go. I just wanted to get other people opinion. Examples or greatly appreciated. Thanks...

  1. #1

    Default Adding Literal Controls in CreateChildControls - Is this bad?

    Adding Literal Controls in CreateChildControls - Is this bad?

    Someone told me it was but every example I've seen does not have a
    problem doing it. They told me I should add the html to the page in
    the render method and add the control where I want them to go.

    I just wanted to get other people opinion. Examples or greatly
    appreciated. Thanks
    KJ Guest

  2. #2

    Default Re: Adding Literal Controls in CreateChildControls - Is this bad?

    Well,

    if thinking it from working solution point, it does work, there's no problem
    but the drawback with the approach are:

    1. You lose ASP.NET's adaptive rendering. If you'd use rendering methods and
    especially HtmlTextWriter's methods and enumerations to output the markup,
    ASP.NET would be automatically capable to adjust the markup based on
    browser.

    2. You increase the size of Control tree. It is not performance wise as
    increased control tree means more processing for the entire Control tree
    (collection).

    But as I said, it works, but with certain things to think about.

    --
    Teemu Keiski
    MCP, Designer/Developer
    Mansoft tietotekniikka Oy
    [url]http://www.mansoft.fi[/url]

    AspInsiders Member, [url]www.aspinsiders.com[/url]
    ASP.NET Forums Moderator, [url]www.asp.net[/url]
    AspAlliance Columnist, [url]www.aspalliance.com[/url]


    "KJ" <klj_mcsdhotmail.com> wrote in message
    news:d83a9214.0308141259.7ccdf16bposting.google.c om...
    > Adding Literal Controls in CreateChildControls - Is this bad?
    >
    > Someone told me it was but every example I've seen does not have a
    > problem doing it. They told me I should add the html to the page in
    > the render method and add the control where I want them to go.
    >
    > I just wanted to get other people opinion. Examples or greatly
    > appreciated. Thanks

    Teemu Keiski Guest

Similar Threads

  1. Recommended way to add child controls in CreateChildControls
    By paul.hester@gmail.com in forum ASP.NET Building Controls
    Replies: 4
    Last Post: August 5th, 02:22 PM
  2. Replies: 0
    Last Post: November 1st, 10:11 PM
  3. What's wrong with rpc-literal? Why use doc-literal?
    By Anonieko Ramos in forum ASP.NET Web Services
    Replies: 0
    Last Post: September 27th, 09:06 AM
  4. Dynamically loading and adding usercontrols after CreateChildControls
    By Hendrik W. Hansen in forum ASP.NET Building Controls
    Replies: 1
    Last Post: May 30th, 12:39 PM
  5. Adding literal content to webcontrol via editor
    By Memi Lavi in forum ASP.NET Building Controls
    Replies: 0
    Last Post: August 30th, 06:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139