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

passing values between controls

Hi all, learning the asp.net is a slow process... but I am plodderign
along. I have hit a bit of a snag - I have 4 pages of code here...
control1.ascx
control2.ascx
default.asx... default.asx.vb

relevant details (i think) on default.asx:
<uc1:ProductList ID="ProductList1" runat="server"
OnPreRender="getSelectedProduct" />
<uc2:ProductDetails ID="ProductDetails1" runat="server" />

on default.asx.vb:
Protected Sub getSelectedProduct(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Write("TEST: " & ProductList1.selectedProduct())
End Sub

To this point the system actually works. When i select a product in the
1st User Control, it is displayed on the main page, however, I need to
take this one step further... base what happens in UC2 on what has
happened in UC1.

what would I type in UC2, to reference to get the value of the
selection in UC1 ?

Mar 20 '06 #1
1 1221

You need to think of your user controls as objects....

and as an object, it can expose properties, read and/or write properties.

public string PropertyOfUserControl1
{
get {return "this could be a member variable";}
}
Then you can read the property from uc1, and set a property of uc2.
uc2.PropertyOfUserControl2 = uc1.PropertyOfUserControl1;
If the code behind of uc2...you need to deal with the property you set.

<ev******@bigpond.net.au> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
Hi all, learning the asp.net is a slow process... but I am plodderign
along. I have hit a bit of a snag - I have 4 pages of code here...
control1.ascx
control2.ascx
default.asx... default.asx.vb

relevant details (i think) on default.asx:
<uc1:ProductList ID="ProductList1" runat="server"
OnPreRender="getSelectedProduct" />
<uc2:ProductDetails ID="ProductDetails1" runat="server" />

on default.asx.vb:
Protected Sub getSelectedProduct(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Write("TEST: " & ProductList1.selectedProduct())
End Sub

To this point the system actually works. When i select a product in the
1st User Control, it is displayed on the main page, however, I need to
take this one step further... base what happens in UC2 on what has
happened in UC1.

what would I type in UC2, to reference to get the value of the
selection in UC1 ?

Mar 20 '06 #2

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

Similar topics

7
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
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...
0
by: Neelima Godugu | last post by:
Hi All, I have developed a windows forms user control, which I am going to host in Internet Explorer.. I am familiar with the security settings requirement inorder to do the above. I have...
2
by: Jim Heavey | last post by:
I know that I can create session variables and pass those values from one screen to another, but is there not a way to makes variables from one scree n available to another screen other then...
8
by: Chris | last post by:
Hi, I have two froms (form1 and form2). I want to be able to pass values from form 1 to form2 and be able to use those values leter in form2. This is my code for form1 Private Sub...
1
by: panche | last post by:
I'm developing a fairly simple user control that has two textboxes for date/time entry (a from date/time and a to date/time). One of my requirements is that there should be no button that sets...
13
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On...
3
by: Ross McLean | last post by:
Hi all, I've been teaching myself C# for a new project at work. I have a bit of a background in c++ and java but never been what you could call a guru. I'm having some strange things happening...
3
by: Andy B | last post by:
I have a web form that has controls to be modified on it. The class that will modify the controls is not contained inside the page code. How would I best pass the controls to the external class?
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.