Usercontrols passing data back to the Page object

T

Tarun Mistry

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
 
A

Abdul Aleem

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
 
T

Tarun Mistry

Thanks Abdul, however todo this will I have to declare the variables/server
controls again?

for example I would want:

private void Submit1_ServerClick(object sender, System.EventArgs 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
 
T

Tarun Mistry

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top