Need Custom DataReader Loop in User Control: inline vs. code-behind

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Need Custom DataReader Loop in User Control: inline vs. code-behind

    I'm trying to evaluate the benefits of designing user controls completely
    inline vs. using a code-behind file. I already have a user control designed
    that does the following:

    - gets QString values from URL
    - creates DataReader from Sproc
    - loops through datareader to display custom output (not using any web
    controls here - all custom output)
    - during the loop, uses a site-wide class call common functions

    I've moved this (more or less) to a code-behind file (I like that I get the
    intellisense working when using a .cs file is one reason :). The one thing
    I'm curious about is, I had to use a <asp:Label> in my .ascx page in order
    to place my datareader content in the right place (if I kept it in the
    PageLoad event, it's printed at the top of the page), and I had to use a
    StringBuilder.

    Which is the best way to do this - does it really matter which way I
    implement this?

    thanks, j


    Jordan Guest

  2. Similar Questions and Discussions

    1. custom web controls and conversion to inline code
      Our client wanted delivery of the code using inline scripting, but for obvious reasons, we developed the ASP.NET 1.1 app using codebehind. We have...
    2. Custom control fires event but ignores some code in the code behind file
      I do not quite understand the question. I will merely point out that most programming problems happen for a reason. Code works the way it is...
    3. Custom Control that accepts Inline Code
      I created a control which parses its sub objects and wraps the code in an HTML wrapper. For example: <abc:Section ID="Section1" Runat="server"...
    4. Custom Server Control works on page but not User Control...why?
      I'm developing the DevEdit.NET server control (an online HTML editor - www.devedit.com) but there's an extremely bizarre bug. The control runs fine...
    5. Page Load fired 3 times Web user control is embedded in a custom control
      Hi, I have built a custom control that build a table with 3 cells in it. The custom control is designed to add all child controls to cell#2,...
  3. #2

    Default Re: Need Custom DataReader Loop in User Control: inline vs. code-behind

    I would stick with the code-behind model. One of its benefits, as
    you've noted, is IntelliSense. You also can debug easier using the
    code-behind technique (setting breakpoints and whatnot). Furthermore,
    it fosters better OOP development practices, IMO.

    --

    Scott Mitchell
    [email]mitchell@4guysfromrolla.com[/email]
    [url]http://www.4GuysFromRolla.com[/url]
    [url]http://www.ASPMessageboard.com[/url]
    [url]http://www.ASPFAQs.com[/url]

    * When you think ASP, think 4GuysFromRolla.com!
    Scott Mitchell [MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may 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