Question regarding user controls

Discussion in 'ASP .Net' started by =?Utf-8?B?RG90TmV0RGV2?=, Oct 27, 2006.

  1. Hi

    I have a control (child2.ascx). Which I place in a repeater in another
    controls (child1.ascx). Child2.ascx is again placed in a repeater on a
    Page(Page1.aspx).

    What will be a good way to pass some properties? For example on Page1.aspx I
    have a variable '_isAdmin'. Based on this variable I want to initialize
    '_isAdmin' variables in both child controls.

    How should I do this?

    Thanks in advance.
    =?Utf-8?B?RG90TmV0RGV2?=, Oct 27, 2006
    #1
    1. Advertising

  2. If you make a public IsAdmin Property (not a public field -- a real property)
    then you can set this property either programmatically or declaratively in
    the markup. You can even provide an overloaded ctor that accepts and sets the
    value.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "DotNetDev" wrote:

    > Hi
    >
    > I have a control (child2.ascx). Which I place in a repeater in another
    > controls (child1.ascx). Child2.ascx is again placed in a repeater on a
    > Page(Page1.aspx).
    >
    > What will be a good way to pass some properties? For example on Page1.aspx I
    > have a variable '_isAdmin'. Based on this variable I want to initialize
    > '_isAdmin' variables in both child controls.
    >
    > How should I do this?
    >
    > Thanks in advance.
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Oct 27, 2006
    #2
    1. Advertising

  3. Thanks for your response.

    I can do through Markup for the Child1.ascx (embeded in the .aspx page). But
    I'm running into problems trying to do the same thing in markup of
    Child2.ascx which is embeded in Child1.ascx. If I hardcode 'true' in
    child2.ascx it would work.

    Seems to be because sequence of different events. Still trying to figure out.

    Thnx.




    "Peter Bromberg [C# MVP]" wrote:

    > If you make a public IsAdmin Property (not a public field -- a real property)
    > then you can set this property either programmatically or declaratively in
    > the markup. You can even provide an overloaded ctor that accepts and sets the
    > value.
    > Peter
    >
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "DotNetDev" wrote:
    >
    > > Hi
    > >
    > > I have a control (child2.ascx). Which I place in a repeater in another
    > > controls (child1.ascx). Child2.ascx is again placed in a repeater on a
    > > Page(Page1.aspx).
    > >
    > > What will be a good way to pass some properties? For example on Page1.aspx I
    > > have a variable '_isAdmin'. Based on this variable I want to initialize
    > > '_isAdmin' variables in both child controls.
    > >
    > > How should I do this?
    > >
    > > Thanks in advance.
    =?Utf-8?B?RG90TmV0RGV2?=, Oct 27, 2006
    #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. =?Utf-8?B?TWFubnkgQ2hvaGFu?=

    Question regarding interactive user controls

    =?Utf-8?B?TWFubnkgQ2hvaGFu?=, Oct 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    304
    =?Utf-8?B?RXRoZW0gQXp1bg==?=
    Oct 17, 2004
  2. Replies:
    1
    Views:
    398
    jasonkester
    Aug 18, 2005
  3. Faizan Ahmed
    Replies:
    1
    Views:
    266
    John Saunders
    Jan 4, 2005
  4. Faizan Ahmed
    Replies:
    1
    Views:
    340
    John Saunders
    Jan 4, 2005
  5. Billy Boy

    Newbie Web Service Question regarding User Controls

    Billy Boy, Mar 3, 2004, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    102
    Billy Boy
    Mar 6, 2004
Loading...

Share This Page