Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. PreRender Question...

PreRender Question...

Scheduled Pinned Locked Moved ASP.NET
questiondesignregex
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    e laj
    wrote on last edited by
    #1

    In WebCustomControl the pre-render is executed before rendering:-) - We all know that. BUT - i noticed that this expected behavior doesn't match the design time. That is, in run time the rendering process is somthing like: ....-->OnPreRender-->PreRender(Event)-->Render-->... while in design time is: ....???-->Render-->... I would like to add some code to be executed JUST BEFORE rendering and that should be run ALSO in design time. Thanks in advanced, Ilan

    M 1 Reply Last reply
    0
    • E e laj

      In WebCustomControl the pre-render is executed before rendering:-) - We all know that. BUT - i noticed that this expected behavior doesn't match the design time. That is, in run time the rendering process is somthing like: ....-->OnPreRender-->PreRender(Event)-->Render-->... while in design time is: ....???-->Render-->... I would like to add some code to be executed JUST BEFORE rendering and that should be run ALSO in design time. Thanks in advanced, Ilan

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      e-laj wrote:

      That is, in run time the rendering process is somthing like: ....-->OnPreRender-->PreRender(Event)-->Render-->... while in design time is: ....???-->Render-->...

      The life cycle of the control at run time should be taking place in the way that you already know. However, thing is a bit different at design time since each control has a control designer that is responsible for controlling the appearance of the control at design time. In details, the GetDesignTimeHtml method of the designer will invoke the Render method of the control to create the appearance for the control in the design view. So your sample code in the PreRender event handler only runs at run time, and it does not get executed by the designer. For more information, you can see: Implementing a Simple Web Forms Control Designer[^]

      e-laj wrote:

      I would like to add some code to be executed JUST BEFORE rendering and that should be run ALSO in design time

      There are two options IMO that you might consider: + In the custom control, you override the Render method, and execute your sample code in there. + Implement a custom control designer for your custom control, and you can ovveride the GetDesignTimeHtml method to execute your sample code at design time only.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups