473,465 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Newbee: Passing Integer to User Control

I'm trying to construct a header user control and would like to pass an
integer to the control in order to display the correct on state for a menu.
How does one pass an integer from an .aspx page to an .ascx page when the
page loads?

Thanks.
Nov 18 '05 #1
5 1239
in the ASCX you can use the Request.Querystring if it's there,
otherwise you may need to create a public property in the control to pass it
to

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"DotNet" <as*****@hotmail.com> wrote in message
news:u7**************@TK2MSFTNGP12.phx.gbl...
I'm trying to construct a header user control and would like to pass an
integer to the control in order to display the correct on state for a menu. How does one pass an integer from an .aspx page to an .ascx page when the
page loads?

Thanks.

Nov 18 '05 #2
It sounds like you're migrating from ASP to ASP.Net, in that your thinking
procedurally rather than object-orieted. In ASP.Net it is more useful to
think about objects and classes than files. A Page is a class. A User
Control is a class. Therefore, you would not "pass" data from one class to
the other. You set properties. Now, you can also call Methods in a class,
and pass them data. So, you have 2 choices: (1) Set a property, and (2) Call
a method.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"DotNet" <as*****@hotmail.com> wrote in message
news:u7**************@TK2MSFTNGP12.phx.gbl...
I'm trying to construct a header user control and would like to pass an
integer to the control in order to display the correct on state for a menu. How does one pass an integer from an .aspx page to an .ascx page when the
page loads?

Thanks.

Nov 18 '05 #3
I'm really having trouble getting the public property in the control to
work. Can you supply a simple example of the aspx and ascx pages? Nothing
elaborate just a really basic code sample.

Thanks.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
in the ASCX you can use the Request.Querystring if it's there,
otherwise you may need to create a public property in the control to pass it to

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"DotNet" <as*****@hotmail.com> wrote in message
news:u7**************@TK2MSFTNGP12.phx.gbl...
I'm trying to construct a header user control and would like to pass an
integer to the control in order to display the correct on state for a

menu.
How does one pass an integer from an .aspx page to an .ascx page when the page loads?

Thanks.


Nov 18 '05 #4
Exactly right you are. I realize this is a simple concept, but migrating the
architecture is a challenge. We'd like to keep the project template driven -
our headers dynamically generate menu HTML code. I "think" that a user
control method is best for that - but if I'm wrong, please let me know. We
are trying to seperate HTML from logic, so if there is a better or more
sensible way of going about this can you let me know?

-w

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl...
It sounds like you're migrating from ASP to ASP.Net, in that your thinking
procedurally rather than object-orieted. In ASP.Net it is more useful to
think about objects and classes than files. A Page is a class. A User
Control is a class. Therefore, you would not "pass" data from one class to
the other. You set properties. Now, you can also call Methods in a class,
and pass them data. So, you have 2 choices: (1) Set a property, and (2) Call a method.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"DotNet" <as*****@hotmail.com> wrote in message
news:u7**************@TK2MSFTNGP12.phx.gbl...
I'm trying to construct a header user control and would like to pass an
integer to the control in order to display the correct on state for a

menu.
How does one pass an integer from an .aspx page to an .ascx page when the page loads?

Thanks.


Nov 18 '05 #5
Sounds like you're on the right track. We've been looking at CSS for better
separation of UI logic and presentation. But your method for generating a
common menu system seems sound.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"DotNet" <as*****@hotmail.com> wrote in message
news:uj**************@TK2MSFTNGP11.phx.gbl...
Exactly right you are. I realize this is a simple concept, but migrating the architecture is a challenge. We'd like to keep the project template driven - our headers dynamically generate menu HTML code. I "think" that a user
control method is best for that - but if I'm wrong, please let me know. We
are trying to seperate HTML from logic, so if there is a better or more
sensible way of going about this can you let me know?

-w

"Kevin Spencer" <ke***@takempis.com> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl...
It sounds like you're migrating from ASP to ASP.Net, in that your thinking
procedurally rather than object-orieted. In ASP.Net it is more useful to
think about objects and classes than files. A Page is a class. A User
Control is a class. Therefore, you would not "pass" data from one class to the other. You set properties. Now, you can also call Methods in a class, and pass them data. So, you have 2 choices: (1) Set a property, and (2)

Call
a method.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"DotNet" <as*****@hotmail.com> wrote in message
news:u7**************@TK2MSFTNGP12.phx.gbl...
I'm trying to construct a header user control and would like to pass an integer to the control in order to display the correct on state for a

menu.
How does one pass an integer from an .aspx page to an .ascx page when

the page loads?

Thanks.



Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
4
by: cmc | last post by:
I need some clarification to help me understand the DB2 strucure more. The questions are about "implicit schema" 1. This is a very interest concpet that DB2 let every user to create new schema...
4
by: PerryC | last post by:
All, 1. Do the following codes seem ok? 2. If so, then how do I pull the value of YOE1 and YOE2 into my report? (to do some further calculations) ...
3
by: nahur | last post by:
why do you need a heap and a stack why not all memory called a heap or call it a stack what is the purpose of having a heap and a stack
2
by: Akira | last post by:
Hello. I'm having problem with passing parameters from .aspx file to user control. Could anyone tell me how to pass parameters from .aspx file to user control(.ascx) and how to recieve parameters...
1
by: DC Gringo | last post by:
I have a simple index.aspx page that declares and sets a sectionID in the Page_Load. The in a user control later on in the page, I read the sectionID variable (in the control's Page_Load) to...
3
by: Philip Poole | last post by:
Hello everyone, Please help with this as it is driving me up the wall and it is urgent i finish this page, this is the first time I have used User Controls and I think I must have completly...
1
by: Jamil | last post by:
Hello, I am loading the user control daynamically using Page.LoadControl('mycontrol.ascx"). But with this i can not get my datamember's properties. For example i declare a private integer...
4
by: Ranginald | last post by:
Hi, I'm having trouble passing a parameter from my default.aspx page to my default2.aspx page. I have values from a query in a list box and the goal is to pass the "catID" from default.aspx...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.