471,595 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,595 software developers and data experts.

Question regarding user controls

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.
Oct 27 '06 #1
2 999
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.
Oct 27 '06 #2
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.
Oct 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by JezB | last post: by
1 post views Thread by Manny Chohan | last post: by
1 post views Thread by | last post: by
10 posts views Thread by jojobar | last post: by
3 posts views Thread by Henry | last post: by
9 posts views Thread by davetelling | last post: by
2 posts views Thread by Rob Meade | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.