Search:
Namespaces
Discussions
.NET v1.1
Feedback
user control interaction
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngfreeforall' list
.
Ahmed, Salman
Here is my setup:
index.aspx has 2 user controls on the page.
UserControl#1
Has a dropdownlist
UserControl#2
Is suppose to visible only when the user selects a value from the
dropdownlist(uc#1) and clicks the button.
How can I check for a value or post back from user control one for the
dropdownlist?
Reply to this message...
Matt Serdar
in UC1
'create a publicly accessible event for other pages to see, this event will
be raised when the combo is changed
Public Event UC1_Combo_Changed(ByVal sender As Object, ByVal e As
System.EventArgs)
'this is the event for your combo box
Private Sub Uc1_Combo_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Uc1_Combo_.SelectedIndexChanged
RaiseEvent UC1_Combo_Changed(sender, e)
End Sub
'now in your 'parent' page that has the 2 user controls
'you'll have your usercontrol protected event
Protected WithEvents myUC1 As UC1
'if you select from the 2 combo boxes at the top of your IDE's code behind
window you'll find that UC1_Combo_Changed or whatever you named your public
event will appear in the left combo box and then in the 'Declarations' combo
on the right you'll find the public event UC1_Combo_Changed. If you select
these .NET will automatically stub out your private sub to roughly resemble
this
Private Sub UC1_Combo_Changed(ByVal sender As Object, ByVal e As UC1)
Handles Uc1_Combo_.SelectedIndexChanged
End Sub
hth
matt
-----Original Message-----
From: Ahmed, Salman [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 06, 2002 6:33 AM
To: aspngfreeforall
Subject: [aspngfreeforall] user control interaction
Here is my setup:
index.aspx has 2 user controls on the page.
UserControl#1
Has a dropdownlist
UserControl#2
Is suppose to visible only when the user selects a value from the
dropdownlist(uc#1) and clicks the button.
How can I check for a value or post back from user control one for the
dropdownlist?
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
Reply to this message...
Moores, Ian
As far as i am aware there is no way to automatically transfer data from
one usercontrol to another... if there is then i please let me know as
well .. i am doing it using out-of-process session variables....
Ian Moores
Web Developer / WebMaster
iRevolution Ltd
+44 (0)1895 425 789 Direct
+44 (0)1895 444 420 Tel
+44 (0)1895 444 460 Fax
-----Original Message-----
From: Ahmed, Salman [mailto:
Click here to reveal e-mail address
]
Sent: 06 August 2002 14:33
To: aspngfreeforall
Subject: [aspngfreeforall] user control interaction
Here is my setup:
index.aspx has 2 user controls on the page.
UserControl#1
Has a dropdownlist
UserControl#2
Is suppose to visible only when the user selects a value from
the dropdownlist(uc#1) and clicks the button.
How can I check for a value or post back from user control one
for the dropdownlist?
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall]
member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT |
news://ls.asplists.com = NEWSGROUP
Reply to this message...
Ahmed, Salman
One method would be to add the selected item in the httpcontext.items and
then access it from the other user control. Just wanted to get other
peoples thoughts on the topic, there doesn't seem to a 'industry' standard
way of doing this even though I would suspect it is a comment problem.
-----Original Message-----
From: Moores, Ian [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 06, 2002 11:18 AM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: user control interaction
As far as i am aware there is no way to automatically transfer data from one
usercontrol to another... if there is then i please let me know as well .. i
am doing it using out-of-process session variables....
Ian Moores
Web Developer / WebMaster
iRevolution Ltd
+44 (0)1895 425 789 Direct
+44 (0)1895 444 420 Tel
+44 (0)1895 444 460 Fax
-----Original Message-----
From: Ahmed, Salman [mailto:
Click here to reveal e-mail address
]
Sent: 06 August 2002 14:33
To: aspngfreeforall
Subject: [aspngfreeforall] user control interaction
Here is my setup:
index.aspx has 2 user controls on the page.
UserControl#1
Has a dropdownlist
UserControl#2
Is suppose to visible only when the user selects a value from the
dropdownlist(uc#1) and clicks the button.
How can I check for a value or post back from user control one for the
dropdownlist?
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
Reply to this message...
Feduke Cntr Charles R
You could mark your controls as serializable and then have a method or
constructor in another control that consumes the serial stream of another
user control to share data between the controls.
Of course I don't think the above has anything to do with the question
that was asked. You probably want to take a look at the
OnSelectIndexChanged event (make sure ViewState for the
DropDownList
is
enabled for this event to fire!) with AutoPostBack = true (when AutoPostBack
is set to true on a
DropDownList
, the page will automatically post back to
the server when the DropDownList's contents are changed). Then in your
SelectIndexChanged event you'd just userControl2.Visible = true;. This
doesn't do anything for client-side script, but to do that just...
<asp:DropDownList onClick="document.<%= userControl2.UniqueID
%>.style.visible = 'visible';" />
<!-- might have to check on that JavaScript above, its from memory -->
assuming userControl2 is the Id of your second user control and its also
defined as a variable in your code behind file.
HTH,
- Chuck
-----Original Message-----
From: Moores, Ian [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 06, 2002 11:18 AM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: user control interaction
As far as i am aware there is no way to automatically transfer data from one
usercontrol to another... if there is then i please let me know as well .. i
am doing it using out-of-process session variables....
Ian Moores
Web Developer / WebMaster
iRevolution Ltd
+44 (0)1895 425 789 Direct
+44 (0)1895 444 420 Tel
+44 (0)1895 444 460 Fax
-----Original Message-----
From: Ahmed, Salman [mailto:
Click here to reveal e-mail address
]
Sent: 06 August 2002 14:33
To: aspngfreeforall
Subject: [aspngfreeforall] user control interaction
Here is my setup:
index.aspx has 2 user controls on the page.
UserControl#1
Has a dropdownlist
UserControl#2
Is suppose to visible only when the user selects a value from the
dropdownlist(uc#1) and clicks the button.
How can I check for a value or post back from user control one for the
dropdownlist?
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
Reply to this message...
Ahmed, Salman
I have a button that has a onclick event that checks for the value selected
in the listbox..do I have to reload the listbox with the values from the
database before doing this check?
I keep getting System.NullReferenceException: Object reference not set to an
instance of an object.??
My Code:
public void btnEditUser_Click(object sender,
EventArgs
e)
{
Response.Write (lbUsers.SelectedItem.Value);
}
-----Original Message-----
From: Ahmed, Salman [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 06, 2002 12:46 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: user control interaction
One method would be to add the selected item in the httpcontext.items and
then access it from the other user control. Just wanted to get other
peoples thoughts on the topic, there doesn't seem to a 'industry' standard
way of doing this even though I would suspect it is a comment problem.
-----Original Message-----
From: Moores, Ian [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 06, 2002 11:18 AM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: user control interaction
As far as i am aware there is no way to automatically transfer data from one
usercontrol to another... if there is then i please let me know as well .. i
am doing it using out-of-process session variables....
Ian Moores
Web Developer / WebMaster
iRevolution Ltd
+44 (0)1895 425 789 Direct
+44 (0)1895 444 420 Tel
+44 (0)1895 444 460 Fax
-----Original Message-----
From: Ahmed, Salman [mailto:
Click here to reveal e-mail address
]
Sent: 06 August 2002 14:33
To: aspngfreeforall
Subject: [aspngfreeforall] user control interaction
Here is my setup:
index.aspx has 2 user controls on the page.
UserControl#1
Has a dropdownlist
UserControl#2
Is suppose to visible only when the user selects a value from the
dropdownlist(uc#1) and clicks the button.
How can I check for a value or post back from user control one for the
dropdownlist?
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
Reply to this message...
Thomas Fuller
Need to see more code to be sure. Is this code fired off on the postback?
Is there n item actually chosen. I'm working on something that uses these
list box values right now and your syntax looks fine below. I think the
problem is somewhere other than here.
Tom
-----Original Message-----
From: Ahmed, Salman [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 06, 2002 1:40 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: user control interaction
I have a button that has a onclick event that checks for the value selected
in the listbox..do I have to reload the listbox with the values from the
database before doing this check?
I keep getting System.NullReferenceException: Object reference not set to an
instance of an object.??
My Code:
public void btnEditUser_Click(object sender,
EventArgs
e)
{
Response.Write (lbUsers.SelectedItem.Value);
}
-----Original Message-----
From: Ahmed, Salman [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 06, 2002 12:46 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: user control interaction
One method would be to add the selected item in the httpcontext.items and
then access it from the other user control. Just wanted to get other
peoples thoughts on the topic, there doesn't seem to a 'industry' standard
way of doing this even though I would suspect it is a comment problem.
-----Original Message-----
From: Moores, Ian [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, August 06, 2002 11:18 AM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: user control interaction
As far as i am aware there is no way to automatically transfer data from one
usercontrol to another... if there is then i please let me know as well .. i
am doing it using out-of-process session variables....
Ian Moores
Web Developer / WebMaster
iRevolution Ltd
+44 (0)1895 425 789 Direct
+44 (0)1895 444 420 Tel
+44 (0)1895 444 460 Fax
-----Original Message-----
From: Ahmed, Salman [mailto:
Click here to reveal e-mail address
]
Sent: 06 August 2002 14:33
To: aspngfreeforall
Subject: [aspngfreeforall] user control interaction
Here is my setup:
index.aspx has 2 user controls on the page.
UserControl#1
Has a dropdownlist
UserControl#2
Is suppose to visible only when the user selects a value from the
dropdownlist(uc#1) and clicks the button.
How can I check for a value or post back from user control one for the
dropdownlist?
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT | news://ls.asplists.com
= NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID |
http://www.asplists.com/aspngfreeforall
JOIN/QUIT | news://ls.asplists.com = NEWSGROUP
Reply to this message...
System.EventArgs
System.NullReferenceException
System.Web.UI.UserControl
System.Web.UI.WebControls.DropDownList
System.Windows.Forms.UserControl
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com