Carrying form data between two pages

M

Matt Jensen

Howdy
Am having a nightmare trying to do what seems should be simple.
Following this article
http://www.codeproject.com/aspnet/DataPassingBtPages.asp but getting an
error 'Classname' is defined in multiple places on the line below with the
****

Here's the offending snippet of code:

<%@ Reference Page="request-job.aspx" %>
RequestJobStep1 fp; //****
protected void Page_Load(Object Src, EventArgs E) {
if (!IsPostBack) {
fp = CType(Context.Handler, RequestJobStep1);
}
}
</script>




on request-job.aspx I've got

<script>
public int WebOption
{
get{return rbl3.SelectedIndex ;}
}
public int PrintOption
{
get{return rbl4.SelectedIndex;}
}

private void btnSubmit_Click(object sender, System.EventArgs e)
{
Server.Transfer("request-job-step2.aspx", true);
}
</script>

Hopefully this is enough code to help identify the problem.
Any help would be greatly appreciated.
Matt
 
M

Matt Jensen

Sorry, had the page classname in the second page which it obviously
shouldn't have been !
Doh
Matt
 
H

Hugo Flores

By reading the article I also thing you shouldn't do what the article
says, anyway, it takes more time, and programming effort than other
solutions, to pass information between pages.
 
M

Matt Jensen

What do you suggest as the alternative then?
Seemed fairly easy to mean when I debugged my page...
Thanks
Cheers
Matt
 
H

Hugo Flores

The easy way to deal with Server.Transfer is like classic ASP use to
deal with it. As Server.Transfer carries all the form information to
the page that you specify. You only need to put a Request.Form("field")
to get the values from each field on your form.
Now, I was told the next thing when I asked what was the best way to
pass information between pages, regarding Server.Transfer
"As far as I know using request parameters (querystring) is more
efficient (when you use
Server.Transfer ASP.NET will have to process the viewstate posted back
to the page you are transferring from)".
So it's your choice wheter to still use Server.Transfer or not, but if
you decide to stay with it, save the extra work an just use the
Request.Form method to get the values from your fields.
 
M

Matt Jensen

Ahh, good point about Request.Form
Btw, don't want to use querystring in this case because of 'security'
reasons.
Cheers
Matt
 

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

No members online now.

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top