473,396 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 1037
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
3
by: JezB | last post by:
What's the generally accepted approach for using Styles and Stylesheets in a web application based on .aspx files, Web Controls, User Controls, and code-behind modules (c# in my case)? Most style...
1
by: Manny Chohan | last post by:
Hi Guys, I am newbie using C#. I have a header control with drop down application list. i need to hide panels in the navigation user control which presents users with different menus based on...
1
by: | last post by:
Hoping to get some ideas from more experienced hands regarding the best way to use object-oriented design to assist my development of a content management system destined for multiple devices. ...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
3
by: Henry | last post by:
I know it is possible to store dynamic propterties for applications in XML files. The app.config and the web.config files can be used to store AppSettings... I am just wondering how far one can...
9
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I...
2
by: Rob Meade | last post by:
Hi all, Ok - I have a few objects I've created, some live in my dal, some in my bol and some in my ui... Here's the thing - I have the need to persist an ID which is used for display purposes...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.