dynamically generate controls on an asp page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    #1

    dynamically generate controls on an asp page

    Hi,
    I have 2 scenarios:
    First, an aspx page that contains 300 controls with the labels of course in
    a table.

    Second, an empty aspx page that contains on loading a script that creates
    the 300 controls dynamically.

    On every open of the page for reading, the system will fetch data from SQL
    and draw the 300 labels with the corresponding data and On every edit of the
    page the system will also draw the 300 label with 300 controls and display
    the data.

    I would like to know first, is creating the 300 control visually by drag and
    drop (scenario 1) , is the same as creating the controls by script (scenario
    2)?

    How are things translated internally when a user requests a page?

    thx.


  • Patrice

    #2
    Re: dynamically generate controls on an asp page

    Basically yes, an ASPX page is not processed as is. ASP.NET creates the code
    for markup and this is running this code that ultimately creates the page.
    You can even see the code created for those files in the ASP.NET temporary
    folder...

    If the question is performance related, as always the best bet is just to
    give this a try. IWith cut/paste it should be easy to create similar pages
    by code and using ASPX markup and see by yourself how it behaves...

    --
    Patrice

    <sama écrit dans le message de groupe de discussion :
    8F9B65EE-263D-41AD-A163-C8E46C464657@mi crosoft.com...
    Hi,
    I have 2 scenarios:
    First, an aspx page that contains 300 controls with the labels of course
    in a table.
    >
    Second, an empty aspx page that contains on loading a script that creates
    the 300 controls dynamically.
    >
    On every open of the page for reading, the system will fetch data from SQL
    and draw the 300 labels with the corresponding data and On every edit of
    the page the system will also draw the 300 label with 300 controls and
    display the data.
    >
    I would like to know first, is creating the 300 control visually by drag
    and drop (scenario 1) , is the same as creating the controls by script
    (scenario 2)?
    >
    How are things translated internally when a user requests a page?
    >
    thx.
    >
    >

    Comment

    • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

      #3
      RE: dynamically generate controls on an asp page

      control placed on the form generate code like

      TextBox1 = new TextBox();
      TextBox1.CssCla ss = "myClass";
      ....

      this code is executed on every page render and postback. so you should see
      no difference unless you loop logic is real slow, or your sqlquery is real
      slow.

      but in your case 300 rows may be real slow to render by the browser.
      generally 50 is the max. you might want to look at a paging model.



      -- bruce (sqlwork.com)


      "sam" wrote:
      Hi,
      I have 2 scenarios:
      First, an aspx page that contains 300 controls with the labels of course in
      a table.
      >
      Second, an empty aspx page that contains on loading a script that creates
      the 300 controls dynamically.
      >
      On every open of the page for reading, the system will fetch data from SQL
      and draw the 300 labels with the corresponding data and On every edit of the
      page the system will also draw the 300 label with 300 controls and display
      the data.
      >
      I would like to know first, is creating the 300 control visually by drag and
      drop (scenario 1) , is the same as creating the controls by script (scenario
      2)?
      >
      How are things translated internally when a user requests a page?
      >
      thx.
      >
      >

      Comment

      Working...