Custom control loading order

Discussion in 'ASP .Net Building Controls' started by devtotal@com.com, Apr 27, 2007.

  1. Guest

    Hi, I have a custom control which loads data, with some critera from a
    property of the hosting UserControl.

    I try to get the property value on BindingChanged in my custom control,
    but, at that time, host UserControl is not completly loaded, so my
    property is NULL.

    I can't call a custom control's method from host UserControl. It would
    'destroy' the automatic behaviour...

    How can I know in my custome control that the host UserControl has
    finished to load ?

    TIA
     
    , Apr 27, 2007
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > Hi, I have a custom control which loads data, with some critera from a
    > property of the hosting UserControl.
    >
    > I try to get the property value on BindingChanged in my custom control,
    > but, at that time, host UserControl is not completly loaded, so my
    > property is NULL.
    >
    > I can't call a custom control's method from host UserControl. It would
    > 'destroy' the automatic behaviour...
    >
    > How can I know in my custome control that the host UserControl has
    > finished to load ?


    Instead of having the custom control grab a property of the hosting control,
    why not have the hosting control set a property of the custom control?
    --

    John Saunders [MVP]
     
    John Saunders [MVP], Apr 27, 2007
    #2
    1. Advertising

  3. Guest

    Because, I can have up to 15 custom controls of diferent types using the
    UserControl's value in 40 UserControls...

    I could loop for my custom control type, and set the value in each ot
    the UserControls , but it's a lot more code, and i want it to be as
    readible as possible...

    So, I only wonder if the custom control has a 'Framework' way to know
    that the host UserControl is loaded...


    John Saunders [MVP] a écrit :
    > <> wrote in message
    > news:...
    >> Hi, I have a custom control which loads data, with some critera from a
    >> property of the hosting UserControl.
    >>
    >> I try to get the property value on BindingChanged in my custom control,
    >> but, at that time, host UserControl is not completly loaded, so my
    >> property is NULL.
    >>
    >> I can't call a custom control's method from host UserControl. It would
    >> 'destroy' the automatic behaviour...
    >>
    >> How can I know in my custome control that the host UserControl has
    >> finished to load ?

    >
    > Instead of having the custom control grab a property of the hosting control,
    > why not have the hosting control set a property of the custom control?
     
    , Apr 27, 2007
    #3
  4. <> wrote in message
    news:...
    >
    > Because, I can have up to 15 custom controls of diferent types using the
    > UserControl's value in 40 UserControls...


    Well, I don't have much more to offer, other than the observation that your
    design seems to be too tightly-coupled.

    Perhaps your custom controls could implement some particular interface. Your
    user controls could then recursively search their Controls collection for
    controls which implement this interface. You could even move this code into
    a common base class for the user controls.
    --
    John Saunders [MVP]
     
    John Saunders [MVP], Apr 27, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. amw
    Replies:
    1
    Views:
    3,006
    Chris Smith
    Sep 25, 2003
  2. Matt Sokol
    Replies:
    2
    Views:
    386
    Theo Tillotson
    Aug 7, 2003
  3. cspoh
    Replies:
    0
    Views:
    249
    cspoh
    Jul 31, 2003
  4. jdn

    User Control loading order

    jdn, Apr 8, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    437
    Jeffrey Tan[MSFT]
    Apr 13, 2004
  5. ofir
    Replies:
    0
    Views:
    186
Loading...

Share This Page