473,699 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Usercontrols passing data back to the Page object

Hi, i have a page with a user control on it, the uc is a form with a submit
button.

On submitting, how do I make the call get picked up by the webform the user
control is in?

Alteratively, is it possible to post to a different .aspx page?

Thanks,
Taz
Feb 9 '06 #1
4 2562
Hi,

When u add ur user control in the webform, it is added inside the

<form runat="server"> </form>

and all the controls including the ones which are part of a user control
will make the ASPX page post back/submit. Of course your button should have
runat="server", and to pick the up the call, when a button inside a
UserControl is clicked, the Page_Load of the WebForm (aspx) is called first
and after theat the Page_Load of the user control. So, you can pick up the
submit inside the Page_Load of your aspx page.

Regards,
Aleem

"Tarun Mistry" <no****@nospam. com> wrote in message
news:Or******** ******@TK2MSFTN GP14.phx.gbl...
Hi, i have a page with a user control on it, the uc is a form with a submit button.

On submitting, how do I make the call get picked up by the webform the user control is in?

Alteratively, is it possible to post to a different .aspx page?

Thanks,
Taz

Feb 9 '06 #2
Thanks Abdul, however todo this will I have to declare the variables/server
controls again?

for example I would want:

private void Submit1_ServerC lick(object sender, System.EventArg s e)
{
}

to appear in my WebForm, however Submit1 is defined in the Usercontrol.

What is the correct procedure on this.

Further more i need to access all the text fields on the Usercontrol, I dont
want to have to redeclare everything.

Thanks,
Kind regards
Taz
"Abdul Aleem" <al*******@acm. org> wrote in message
news:ds******** *@news-dxb.emirates.ne t.ae...
Hi,

When u add ur user control in the webform, it is added inside the

<form runat="server"> </form>

and all the controls including the ones which are part of a user control
will make the ASPX page post back/submit. Of course your button should
have
runat="server", and to pick the up the call, when a button inside a
UserControl is clicked, the Page_Load of the WebForm (aspx) is called
first
and after theat the Page_Load of the user control. So, you can pick up the
submit inside the Page_Load of your aspx page.

Regards,
Aleem

"Tarun Mistry" <no****@nospam. com> wrote in message
news:Or******** ******@TK2MSFTN GP14.phx.gbl...
Hi, i have a page with a user control on it, the uc is a form with a

submit
button.

On submitting, how do I make the call get picked up by the webform the

user
control is in?

Alteratively, is it possible to post to a different .aspx page?

Thanks,
Taz


Feb 9 '06 #3
There are a variety of ways to pass data between a control and its page.
Generally a page calls methods & sets properties on the control. For the
control to initiate such an exchange it would usually raise an event to the
page.
Here's more info:
http://SteveOrr.net/faq/PassDataToUserControl.aspx
http://SteveOrr.net/faq/PassDataFromUserControl.aspx

--
I hope this helps,
Steve C. Orr
MCSD, MVP
http://Steve.Orr.net

"Tarun Mistry" wrote:
Hi, i have a page with a user control on it, the uc is a form with a submit
button.

On submitting, how do I make the call get picked up by the webform the user
control is in?

Alteratively, is it possible to post to a different .aspx page?

Thanks,
Taz

Feb 9 '06 #4
Hi Steve, many thanks.

Unforunately I am not a VB developer, would it be possible to have the short
code snippets in c#?

It would be incredibly appreciated!

Kind regards
Taz

"Steve C. Orr" <St***@Orr.ne t> wrote in message
news:50******** *************** ***********@mic rosoft.com...
There are a variety of ways to pass data between a control and its page.
Generally a page calls methods & sets properties on the control. For the
control to initiate such an exchange it would usually raise an event to
the
page.
Here's more info:
http://SteveOrr.net/faq/PassDataToUserControl.aspx
http://SteveOrr.net/faq/PassDataFromUserControl.aspx

--
I hope this helps,
Steve C. Orr
MCSD, MVP
http://Steve.Orr.net

"Tarun Mistry" wrote:
Hi, i have a page with a user control on it, the uc is a form with a
submit
button.

On submitting, how do I make the call get picked up by the webform the
user
control is in?

Alteratively, is it possible to post to a different .aspx page?

Thanks,
Taz

Feb 9 '06 #5

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

Similar topics

27
6196
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is done? regards, Oscar
5
1661
by: David Lozzi | last post by:
Hello, I have an interesting issue, so bear with me as I try to explain. I have a datalist posing as tabs for my application. And as each tab is clicked, a placeholder is then populated with the associated control. For Example: Details | Advanced | Configuration | Policies <placeholder> The jumping around works great. I can see each control when clicked. Here's
0
1546
by: seigo | last post by:
Hello, I faced with the following problem. I have a PlaceHolder on a page and a few UserControls which have custom events, for instance: public delegate void SelectHandler(object sender, SelectEventArgs e); public event SelectHandler OnSelect; protected void Page_Load(object sender, EventArgs e)
7
2142
by: Nathan Sokalski | last post by:
I have a page which I dynamically add several usercontrols (*.ascx files) to using the following code: Public Sub Refresh() For Each section As DataRow In Me.GetSections().Rows CType(Me.FindControl("admin" & CStr(section("buttontext")).Replace(" ", "")), adminsection2).RefreshSection() Next End Sub
0
8691
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
9038
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
8920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7755
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5877
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
4378
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
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3060
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 we have to send another system
2
2351
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.