Topaz Filer - Email filing software
Cross-Posting: Webform.aspx?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.faqs.


George Hernandez
GOOD ANSWER
Sorry for the cross-posting, but I didnt know which NG to post this question
in...

Im building a C# Web Application and I was editting a webform with some of
the <ASP> Webform controls. I later noticed that the form action cannot be
changed from the name of the current page. I have tried removing the
runat="server" attribute, but then by webform page fails. What I'm wondering
is, what is the point of having a webform that sumbits to itself, when I
need the data to post to a different page which performs some ASP functions?

Basically here is what I WANT to happen...
Webform collects First, Last Name and Email address, posts to
sendmail.asp...sendmail.asp sends me an email through SMTP of the data
collected, and then redirects to a thankyou page.

if i cant have the Webform.aspx submit to any page other than itself, how do
I perform what Im trying to do above?

Thanks for the help

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
Dima Semensky
GOOD ANSWER
As usually it's a confusion between server and client code. Server form is
something different from regulat HTML form.

M$ is trying to make it easier but again it only add a lot of confusions.

To implement fuctionality you need do this:

1. Build regular webform using web controls
2. OnClick event of the Submit button - Redirect call to needed page. You
can pass parameters in the URL or add parameters to Respons.Param colection.
Or use ViewState....

Hope this helps.

"George Hernandez" <Click here to reveal e-mail address> wrote in message
news:ec#VzSYaCHA.2616@tkmsftngp09...
> Sorry for the cross-posting, but I didnt know which NG to post this
question
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
Rob Epstein
GOOD ANSWER
George,

This might not be the answer you're looking for, but you can always access
the values in the form via the good old Request object. Simply remove the
runat="server" attribute on your form and change the action to point to
sendmail.asp. Also change all the webform controls on the ASPX page to be
standard HTML elements (ie. <asp:TextBox> = <input type="text">).

So there's the quick and dirty solution. Perhaps a more modular approach
would be to wrap the functionality of sendmail.asp into a namespace class
that can be shared across your app. You can then let the webform post to
itself and pass the needed information to your new class that handles the
generation and sending of the email. The class can then send back a success
or failure status that your webform can then hand back to the user along
with any other kind of specialized confirmation text.

So there you go. Two options both of which should solve your problem. I
leave it to you to decide which one best fits your organization and
application needs.

--
Hope that helps,
Rob Epstein
Sr. Application Architect
ComputerJobs.com
"Nothing's impossible until proven so."

"George Hernandez" <Click here to reveal e-mail address> wrote in message
news:ec#VzSYaCHA.2616@tkmsftngp09...
> Sorry for the cross-posting, but I didnt know which NG to post this
question
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
George Hernandez
GOOD ANSWER
"Rob Epstein" <Click here to reveal e-mail address> wrote in message
news:uk1U7ohaCHA.2228@tkmsftngp08...
[Original message clipped]

Wow - thanks for the help, and some of what your saying makes sense....I
guess I should have also included in my post that I'm totally green when it
comes to .NET and as far as anything you suggested in your second option?
........ whooooosh - with the glassy, confused looked in the eyes to go with
it. Im not a C# or a VB developer so I dont know how to perform any of that.

Otherwise, I have already tried the first suggestion you have made, but
without using the .aspx functionality of a standard .NET webform...I have
converted it to .asp, taking the output from the .aspx webform attempt,and
converted it to HTML elements - In other words, what I want to have happen,
is happenning, just not in the way I would like.

[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
 
System.Web.UI.MobileControls.TextBox
System.Web.UI.WebControls.TextBox
System.Windows.Forms.TextBox




Topaz Filer - Email filing software
Ad
BootFX
Reliable and powerful .NET application framework.
Looking to invest in a major software project? Technical and commercial advice available here.
Other Helpful Sites
MBR 247
Topaz Filer
SharePoint Email Filing
Software Advisory Services
 
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734