473,379 Members | 1,184 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,379 software developers and data experts.

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_Load() {

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

}

SideTabs.Page_Load()

Whereas what I would like is

Template.PageLoad() {
//some function calls

SideTabs.PageLoad()

int id = SideTabs.SelectedTabId

GenerateContent(id)
}

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

Please help

Philip
Nov 18 '05 #1
3 1525
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*****@microsoft.com> wrote in message
news:eH**************@TK2MSFTNGP10.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
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...
2
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...
6
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"...
2
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...
2
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...
1
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...
0
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...
1
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...
6
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.