Web User Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • poolguard

    #1

    Web User Control

    I have a web app that uses web user controls to facilitate code reuse however
    I need the controls to run in a specific order when the page is posted back.
    Is there anyway to specify the order in which the controls are processed?

    The page is coded in vb.net

  • Klaus H. Probst

    #2
    Re: Web User Control

    By "processed" you mean the order in which they are loaded?

    I believe you can do this by overriding AddParsedSubObj ect() on the page and
    add each control to a collection you control (instead of the default page
    controls collection). Then override OnInit and call a method that sorts or
    arranges the controls the way you want it as it adds it to the page's
    control collection.

    I've done this before but not specifically to control the load order.


    --
    Klaus H. Probst, MVP



    "poolguard" <poolguard@disc ussions.microso ft.com> wrote in message
    news:17E46A63-7564-469D-B97C-615FFE5E75E7@mi crosoft.com...[color=blue]
    > I have a web app that uses web user controls to facilitate code reuse[/color]
    however[color=blue]
    > I need the controls to run in a specific order when the page is posted[/color]
    back.[color=blue]
    > Is there anyway to specify the order in which the controls are processed?
    >
    > The page is coded in vb.net
    >[/color]


    Comment

    • poolguard

      #3
      Re: Web User Control

      the problem I am having is with the order the controls are processed on the
      post back to the server. I have a nav.ascx and a body.ascx and I need the
      nav.ascx.vb to run before the bod.ascx.vb. I have tries to load the controls
      in a different order with no luck the body.ascx is processed on the server
      first no matter what even triggers the page post back or what order the
      controls are loaded in

      Thanks for you help so. let me know if you have any other ideas


      "Klaus H. Probst" wrote:
      [color=blue]
      > By "processed" you mean the order in which they are loaded?
      >
      > I believe you can do this by overriding AddParsedSubObj ect() on the page and
      > add each control to a collection you control (instead of the default page
      > controls collection). Then override OnInit and call a method that sorts or
      > arranges the controls the way you want it as it adds it to the page's
      > control collection.
      >
      > I've done this before but not specifically to control the load order.
      >
      >
      > --
      > Klaus H. Probst, MVP
      > http://www.vbbox.com/
      >
      >
      > "poolguard" <poolguard@disc ussions.microso ft.com> wrote in message
      > news:17E46A63-7564-469D-B97C-615FFE5E75E7@mi crosoft.com...[color=green]
      > > I have a web app that uses web user controls to facilitate code reuse[/color]
      > however[color=green]
      > > I need the controls to run in a specific order when the page is posted[/color]
      > back.[color=green]
      > > Is there anyway to specify the order in which the controls are processed?
      > >
      > > The page is coded in vb.net
      > >[/color]
      >
      >
      >[/color]

      Comment

      Working...