Initialization of a Web User Control inside Repeater Control

Discussion in 'ASP .Net' started by satyajit, Aug 21, 2007.

  1. satyajit

    satyajit Guest

    I am working on an application that has a Web User Control contained
    within <ItemTemplate> of a Repeater control. The Web User Control has
    a public property that needs to be assigned in order to work correctly
    (the web user control uses this object to initialize DataSource of
    some of its child controls). Is it correct to use Repeater's
    ItemCreated event to assign value to the above mentioned public
    property? If not, what are the alternatives?

    I also want to know at which stage of life-cycle of the contained Web
    User Control, the ItemCreated event of the repeater control will be
    invoked?
     
    satyajit, Aug 21, 2007
    #1
    1. Advertising

  2. Or you can expose a public (or internal?) property on the user control and
    set it using the normal Eval() to pull data and set the property with it.
    Provided, of course, the setting is in the data you are binding to the
    repeater.

    When you think of user controls as black boxes, much like other controls,
    you find you can treat them the same way.

    --
    Gregory A. Beamer
    MVP, MCP: +I, SE, SD, DBA

    *************************************************
    | Think outside the box!
    |
    *************************************************
    "satyajit" <> wrote in message
    news:...
    >I am working on an application that has a Web User Control contained
    > within <ItemTemplate> of a Repeater control. The Web User Control has
    > a public property that needs to be assigned in order to work correctly
    > (the web user control uses this object to initialize DataSource of
    > some of its child controls). Is it correct to use Repeater's
    > ItemCreated event to assign value to the above mentioned public
    > property? If not, what are the alternatives?
    >
    > I also want to know at which stage of life-cycle of the contained Web
    > User Control, the ItemCreated event of the repeater control will be
    > invoked?
    >
     
    Cowboy \(Gregory A. Beamer\), Aug 21, 2007
    #2
    1. Advertising

  3. satyajit

    satyajit Guest

    On Aug 21, 4:13 pm, "Cowboy \(Gregory A. Beamer\)"
    <> wrote:
    > Or you can expose a public (or internal?) property on the user control and
    > set it using the normal Eval() to pull data and set the property with it.
    > Provided, of course, the setting is in the data you are binding to the
    > repeater.


    okay.

    However, if for some reason, it's not possible to do it in the markup,
    we would need to use ItemCreated event. Correct?

    > When you think of user controls as black boxes, much like other controls,
    > you find you can treat them the same way.


    My trouble is that the user control has used the property (in
    question) in its OnInit event. Is it guaranteed that OnInit of user
    control will be called after ItemCreated event of parent repeater
    control? This is not clear in MSDN documentation for "ASP.NET Page
    Life Cycle Overview" <http://msdn2.microsoft.com/en-us/library/
    ms178472.aspx>.

    Thanks.
    - Satyajit

    "satyajit" <> wrote in message
    >
    > news:...
    >
    > >I am working on an application that has a Web User Control contained
    > > within <ItemTemplate> of a Repeater control. The Web User Control has
    > > a public property that needs to be assigned in order to work correctly
    > > (the web user control uses this object to initialize DataSource of
    > > some of its child controls). Is it correct to use Repeater's
    > > ItemCreated event to assign value to the above mentioned public
    > > property? If not, what are the alternatives?

    >
    > > I also want to know at which stage of life-cycle of the contained Web
    > > User Control, the ItemCreated event of the repeater control will be
    > > invoked?
     
    satyajit, Aug 21, 2007
    #3
    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. Replies:
    1
    Views:
    7,033
    Karl Seguin
    Aug 10, 2005
  2. uncensored
    Replies:
    0
    Views:
    824
    uncensored
    Oct 25, 2006
  3. HockeyFan
    Replies:
    1
    Views:
    1,000
    Masudur
    Jul 4, 2007
  4. Microsoft

    Repeater inside a Repeater

    Microsoft, Aug 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    210
    Microsoft
    Aug 21, 2006
  5. Kiran More
    Replies:
    2
    Views:
    322
    Kiran More
    Nov 14, 2006
Loading...

Share This Page