473,748 Members | 9,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User Controls Passing Variables from one control to another

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 misunderstood a basic point.

I have a number of user controls which are used to make up my page. One
control is a series of tabs which are created dynamically from a database.
When someone clicks on a tab, the page reloads and the tabs that was clciked
changes colour to signify it has been selected.

The tabs to be displayed are decided by integer I set by a property.

After the tabs has been created i then want to generate the rest of my page
which wil be dependent on the id of the selected tab.

At the moment I have in my template file (which contains all of the user
controls) a page load method, in the page load method i call the functions
to generate my page. However, this functions are dependent on the selected
tab in the user control and the user control fuctions are not generated
until after the page load of my template page. i.e

Template.Page_L oad() {

generatePage(id ) //but no id!!!!

}

SideTabs.Page_L oad()

Whereas what I would like is

Template.PageLo ad() {
//some function calls

SideTabs.PageLo ad()

int id = SideTabs.Select edTabId

GenerateContent (id)
}

Is this possible? Or how can I get this type of functionaility.

Please help

Philip
Nov 18 '05 #1
3 1543
Make your tab properties store thier data in the viewstate and have the
other controls access that.
Nov 18 '05 #2
Hello Josh,

Thankyou kindly for the advice

do you have any idea on how I do that?

Phil
"Josh" <so*****@micros oft.com> wrote in message
news:eH******** ******@TK2MSFTN GP10.phx.gbl...
Make your tab properties store thier data in the viewstate and have the
other controls access that.

Nov 18 '05 #3
This scenario looks very similar to the Time Tracker starter kit at
www.asp.net.

If SideTabs is a user control, then I don't think you want to explictly
call its page_load event. You just want to load the control, probably
by calling LoadControl.

The specific control has to be loaded with each postback.
Something that had me stumped for a long time is that you must also load
a value to the id property of the control each time (I typically use the
name of the control) and this helps the program keep everything in sync.

A different approach would be to have one base control class for all the
user controls, and put the functions there, but I don't know if that
will help anything in your situation.

Jim
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4

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

Similar topics

2
1369
by: Robin Bonin | last post by:
I have a user control that create a product thumbnail and details. I am working on aother user control that I will pass some variables like # of columns and rows to display these thumbnails. I'm having trouble dynamicly adding a new thumbnail control to my table. Dim newCell As New TableCell Dim newRow As New TableRow Dim productThumb As New htmlBlock_ProductThumb ' This is my usercontrol
2
3023
by: paul meaney | last post by:
All, myself and another developer have been staring blankly at a screen for the past 48 hours and are wondering just what stunningly obvious thing we are missing. We are trying to load up 2 or more user controls dynamically by adding to a placeholder defined in page_load. I've included the sample code for how we are accessing one. The user controls are not rocket science - just a few text boxes with public accessor properties. We've...
6
11299
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
2
1364
by: Wee Bubba | last post by:
i started by designing my web page using frames. i had my data entry form in an upper form and my data rows displaying in a lower frame. i soon discovered that ASP.NET is not really meant for frames so I changed this to a single page with both the entry form and the display rows on it which posts back to itself(an improvement i hope?) ok my single page also needs to have the ability to search for stuff as you enter data. I know I can...
2
2355
by: Jon Hyland | last post by:
This might be a dumb question, but what is the best way for one instance of a user control to access properties of an instance of another user control? For example, let's say I have an instance of UserControlA (ucA1) and an instance of UserControlB (ucB1) on a particular ASP.NET page. UserControlA has a string property called StringA that gets generated from a DB call in it's Page_Load event. I want UserControlB to be able to access...
1
1022
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a variable (targetId) in to the usercontrol (IntergySite.aspx) by calling its setter method. Currently, I am using if-then-else and hardcoded the User Control Object to do casting and call the setter method. Question: Is there any way I could load,...
0
1037
by: ben | last post by:
I am having some difficulty in understanding how to deal with variables, session states, objects, user controls while attempting to develop a ASP.Net application. I have created several user controls which consist of dropdown and textbox controls on a panel. In order for one user control to access a control on another usercontrol, I have to change the WithEvents to "Protected Shared". That will allow a sub to access a control on a...
1
1821
by: weboweb | last post by:
Hello aspnet experts! I have a design question for the more experienced developers (more than me at least :-)). 1) I have a page in the application I'm building that displays a web user control with a list of folders (let's call it the TREE) 2) There is another control called document list which shows the list of documents for the selected tree folder (let's call it DOCLIST)
6
1789
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... Tried posting this on Build Controls but then saw that's a pretty slow group... Kind of a typical request from product management - they want to be able to swap in different 3rd party controls depending on their whim and the day. In this case, they want to support FreeTextBox and Cute Editor interchangably. I've been trying to put together a container control derived from
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.