Hi, i am newbie in ASP
I try to redirect this form after submit to another page....what should i do? Strings of form : - <%@ Page Language="C#" Debug="False" %>
-
<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
-
<%@ import Namespace="System.Web.Mail" %>
-
<script runat="server">
-
-
public void Page_Load() {
-
if (!IsPostBack)
-
content_form.Visible = true ;
-
else {
-
content_result.Visible = true ;
-
content_form.Visible = false ;
-
}
-
-
}
-
-
void submit_click(object sender, ImageClickEventArgs e)
-
{
-
content_form.Visible = false ;
-
MailMessage msg = new MailMessage();
-
string recipient = "ajimenez@yahoo.com" ;
-
-
-
-
msg.To = recipient ;
-
msg.Subject = "Kaba Web Site E-Plex Software reg (Access Control)" ;
-
msg.BodyFormat = MailFormat.Html ;
-
-
-
string message = "Please process as required. Thank You. <br>" ;
-
message += "----------------------------------------------------------- <br><br>";
-
// message += "Reason you are contacting us?" + type_of_info.SelectedValue +" <br><br>" ;
-
message += "Name: " + firstname.Text + " <br><br><br>" ;
-
message += "Company: " + companyname.Text + " <br>" ;
-
if( title.SelectedItem.Value != "" )
-
message += "Title : " + title.SelectedItem.Value.ToString() + " <br><br><br><br>";
-
-
message += "Email : " + email.Text + " <br>" ;
-
-
message += "City : " + city.Text + " <br>" ;
-
message += "State/Province : " + state_province.SelectedItem.Value + " <br> ";
-
if ( zip.Text != "" )
-
message += "Zip/Postal Code: " + zip.Text + " <br> ";
-
if( phone.Text != "" )
-
message += "Phone : " + phone.Text + " <br>";
-
if( fax.Text != "" )
-
message += "Fax : " + fax.Text + " <br>";
-
-
-
-
-
-
-
-
String yes_wants_more_information_on_kaa = Request.Form["yes_wants_more_information_on_kaa"];
-
String yes_mailinglist = Request.Form["yes_mailinglist"];
-
-
message += "<b>Wants this (if listed): </b><br>";
-
-
if (yes_wants_more_information_on_kaa != "")
-
message += yes_wants_more_information_on_kaa + "<br>";
-
-
if (yes_mailinglist != "")
-
message += yes_mailinglist + "<br>";
-
-
-
-
if( comments.Text != "" )
-
message += "Additional details/comments: <br>" ;
-
message += "<p class=\"content_site\" >" + comments.Text + " </p><br>" ;
-
-
-
msg.From = email.Text;
-
msg.Body = message ;
-
SmtpMail.SmtpServer="10.254.250.48" ;
-
SmtpMail.Send(msg) ;
-
-
-
// *** NEED TO REDIRECT WITH SPECIAL CODE?
-
// Response.redirect "http://www.yahoo.com"
-
content_result.Text = "";
-
-
-
content_result.Visible = true ;
-
}
-
-
</script>
Code to submit : - <asp:ImageButton id="submit" onclick="submit_click" runat="server" AlternateText="SUBMIT" ImageAlign="left" ImageUrl="/common/submit.gif"></asp:ImageButton>
7 2289 Frinavale 9,735
Recognized Expert Moderator Expert
In the code that you've posted, you're sending an email once you've clicked a link button on your page...and then you want to redirect the user to another page.
What is the problem with using Response.Redire ct()?
What do you mean by: "I want to redirect with special code"?
What is this "special code" supposed to do?
-Frinny
I put ResponseRedirec t as in :
# content_result. Text = "";
#
#
# content_result. Visible = true ;
# Response.redire ct "http://www.yahoo.com"
And this does not work, it wont redirect :( i dont know how to do a redirection after Submit.
Frinavale 9,735
Recognized Expert Moderator Expert
I really don't know why this would be working for you?
Where are you redirected to?
I have tested your code (minus the email sending part) and it works fine:
I added a link button to the page: -
<asp:LinkButton ID="doRedirect" runat="server" Text="Redirect To Yahoo"></asp:LinkButton>
-
I redirect the user to Yahoo.com when the button is clicked: -
Private Sub doRedirect_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles doRedirect.Click
-
Response.Redirect("http://yahoo.com", True)
-
End Sub
-
Note that I'm supplying a "True" parameter to the Response.Redire ct() method. This indicates that the page should no longer be processed after the user has been redirected...th is avoids any Tread.Abortion exceptions.
Maybe if you uncomment the code responsible for redirecting the user.....it might work?
-Frinny
Not working :( ... i really dont understand
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1002: ; expected
Source Error:
Line 82: content_result. Visible = true ;
Line 83:
Line 84: Private Sub doRedirect_Clic k(ByVal sender As Object, ByVal e As System.EventArg s) Handles doRedirect.Clic k
Line 85: Response.Redire ct("http://yahoo.com", True)
Line 86: End Sub
OK, Frinny was just giving you an example of using Response.Redire ct....and in her example she is using VB.NET, not C# like you are.
In the code you provided you are using it incorrectly.
Response.redire ct "http://www.yahoo.com"
this is incorrect. In C# you have to use parenthesis around method parameters, and end every statement with a semicolon (;). Also, C# is case-sensitive: Response.Redire ct is different than Response.redire ct.
Put this code in at the point you want to redirect: - Response.Redirect("http://www.bytes.com");
And change the bytes URL to wherever you need it to be.
Also note that the code after you redirect is pointless, since you will be taken to another page. You don't need to change anything on the page once you leave.
THANK YOU ALL *IT WORKS WITH Code provided by insertAlias Moderator, i wasnt sure it was c# and i dont know nothing about ASP or .Net or C# ...this was super confusing for me
Thanks alot ! to all of you
BYTES.COM Rocks ! this is Great ! wow you programmers rocks! i wish i had your brain transplanted into mine with all your syntax knowledge ;)
Glad to help, and always happy to get the feedback. Feel free to come back any time =D
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Don |
last post by:
I have a need to simulate the submission of an html-like <form> on the server, and was wondering if
anyone knew of something out there that could do that.
Thanks for your help,
Don
|
by: Martin Nadoll |
last post by:
Hello
i have a form, where my users can choose a postal code and a city to see a
table result page with only entries of their choice.
this results have to be shown in a new window :
var firstLink = unescape(firstURL.cfm');
var secondLink = unescape(secondURL.cfm');
var thirdLink = unescape(thirdURL.cfm');
|
by: M Smith |
last post by:
I have a form I want to submit to itself. I want to be able to type in a
list of numbers and submit the form and have that list show up on the same
form under the text box I typed them into and the buttons. The problem is
when I post a form to itself, the Enter key will not submit the form, it
only clears the contents of the text box. The only way I can submit is to
click the submit button. Here is a simplified version of my code that I...
|
by: horos |
last post by:
hey all,
Ok, a related question to my previous one on data dumpers for
postscript.
In the process of putting a form together, I'm using a lot of
placeholder variables that I really don't care about in the submitted
action. I'd therefore
like to get rid of them by doing something like:
|
by: Hongyu |
last post by:
I am trying to implement a simple JavaScript of redirecting my window
to a new URL upon clicking a submit button. This is an easy task except
when I have to put an input type='submit' in front of the onClick
command. It always commits the CGI action, and skip the URL redirect
part. The example code is below
<form action=mycgi.pl>
<input type='submit' name=submit value='Submit'
onClick="window.location.href='http://myserver.com'">...
| |
by: rjames.clarke |
last post by:
I have the following.
$result=mysql_query($sql);
$nrows=mysql_num_rows($result);
for ($i=0;$i<$nrows;$i++)
{
$row_array=mysql_fetch_row($result);
echo "<form name='testform' action='ins_op.php' method='post'>";
lots of form stuff
|
by: Rachet? |
last post by:
I am getting a "The remote server returned an error: (400) Bad
Request." error while trying to send data to an asp page. The puzzle
is, if I paste the string I want to send on a browser address box, it
just go fine. From the win form app also it go fine until I happen to
send an xml formatted string as a value. But same go fine through the
browser.
Any help is greatly appreciated.
My code looks like:
|
by: Gregor Horvath |
last post by:
Hi,
As I am no expert web programmer I thought I'd better ask the experts if
there is a simpler or better solution to my problem than the one I am
thinking of. (using TurboGears)
The problem
-----------
I have a form. Ok. you can submit, validate it etc.
|
by: gbezas |
last post by:
Hi All,
I have added an event handler to redirect form.submit() to a newSubmit() method that I have defined (which does some additional processing before submitting the form).
Additionally I have defined the relavant function method in the code for details)
The issue is that when Icall targetForm._submit() method from the newSubmit() function the page I get an 'Object doesn't support this property or method' error
I am using IE...
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |