View Full Version : Coding Issue
Budde
09-21-2007, 03:28 AM
I am coding a Contact Form in ASP.NET, and I was wondering what that problem is, so I can send it to an email address...
Name:
<input id="Text1" type="text" /><br />
Email:
<input id="Text2" type="text" /><br />
Subject:
<input id="Text3" type="text" /><br />
Message:<br />
<textarea id="TextArea1" style="width: 202px; height: 80px"></textarea><br />
<br />
<input id="Submit1" type="submit" value="Send Message" />
Thanks,
Josh
nikkiH
09-21-2007, 03:15 PM
This is just a plain form.
Are you trying to use .NET? If so, you need runat=server and stuff, and code to handle the submit, and, well, a lot more than what you posted here.
Budde
09-21-2007, 08:47 PM
This is just a plain form.
Are you trying to use .NET? If so, you need runat=server and stuff, and code to handle the submit, and, well, a lot more than what you posted here.
Yes I am. I will post the code later!
Josh
nikkiH
09-21-2007, 09:00 PM
Ok, please mention ASP.NET version (1.1, 2.0) and whether you use Visual Studio, along with the version if you do.
Budde
09-22-2007, 03:50 AM
Ok, please mention ASP.NET version (1.1, 2.0) and whether you use Visual Studio, along with the version if you do.
Visual Studio 8.0, and can you help me with what needs to be added to the code?
Josh
nikkiH
09-22-2007, 04:03 AM
I could if you posted what you had and said what you were having trouble with.
If you're totally lost and need someone to do the whole thing for you, it would be pretty quick and shouldn't cost much.
We have a forum called Web Projects and you can post there under Paid Work Offers And Requests.
http://www.codingforums.com/forumdisplay.php?f=36
Otherwise, you need to at least do what you can and post it so we can give you help. If you drag and drop components onto the web form from Studio, it doesn't look like what you posted. So start there, and try to put validators on, and whatnot, and read the basic tutorial on mailing forms here.
http://aspnet.4guysfromrolla.com/articles/072606-1.aspx
Budde
09-22-2007, 04:05 AM
I could if you posted what you had and said what you were having trouble with.
If you're totally lost and need someone to do the whole thing for you, it would be pretty quick and shouldn't cost much.
We have a forum called Web Projects and you can post there under Paid Work Offers And Requests.
http://www.codingforums.com/forumdisplay.php?f=36
Otherwise, you need to at least do what you can and post it so we can give you help. If you drag and drop components onto the web form from Studio, it doesn't look like what you posted. So start there, and try to put validators on, and whatnot, and read the basic tutorial on mailing forms here.
http://aspnet.4guysfromrolla.com/articles/072606-1.aspx
Thanks for the help Nikki!
Josh
Budde
09-23-2007, 05:03 AM
How does this Code Look?
<form name="form1" method="post" action="Contact.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTU5MDIwMDAxMWRkQNXCqbCxsicnO1+eGRW88gw4DVs=" />
</div>
<div style="text-align: center">
<input name="NameTextBox" type="text" value="Your Name" id="NameTextBox" style="z-index: 100; left: 326px; position: absolute;
top: 55px" />
<input name="EmailTextBox" type="text" value="Your Email" id="EmailTextBox" style="z-index: 101; left: 326px; position: absolute;
top: 88px" />
<input name="SubjectTextBox" type="text" value="Subject" id="SubjectTextBox" style="z-index: 102; left: 329px;
position: absolute; top: 126px" />
<textarea id="Message" cols="20" rows="2"
style="z-index: 104; left: 321px; position: absolute; top: 165px" language="javascript" onclick="return Message_onclick()"></textarea>
<input type="submit" name="SendButton" value="Send Message" id="SendButton" style="z-index: 105; left: 368px; position: absolute;
top: 227px" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQKAn8XWBAKrwoaOBwKi0/XgDALQm/PiDwLR95WDCHk4G5dmekovoYKYyG/l6LrNf2ne" />
</div></form>
I know I am missing something but what is it?
Thanks,
Josh
SouthwaterDave
09-23-2007, 11:20 AM
This code is what is sent by ASP.NET to the client browser but it is not what you code on the server. The .aspx file should look something like this:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Do something with TextBox1.Text etc. here...
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Name:<asp:TextBox ID="TextBox1" runat="server" /><br />
Email:<asp:TextBox ID="TextBox2" runat="server" /><br />
Subject:<asp:TextBox ID="TextBox3" runat="server" /><br />
Message:<asp:TextBox ID="TextBox4" runat="server" /><br />
<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>
nikkiH
09-24-2007, 04:32 PM
Budde, please post your server-side code, as demonstrated by SouthwaterDave. The client-side from view-source doesn't really tell us what we need to know. :D
Budde
09-26-2007, 10:36 PM
Here is my code:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Do something with TextBox1.Text etc. here...
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Contact Me</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Name:<asp:TextBox ID="TextBox1" runat="server" /><br />
Email:<asp:TextBox ID="TextBox2" runat="server" /><br />
Subject:<asp:TextBox ID="TextBox3" runat="server" /><br />
Message:<asp:TextBox ID="TextBox4" runat="server" /><br />
<asp:Button ID="Button1" runat="server" Text="Send Message" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>I need a TextArea instead of TextBox. Can someone help me with this?
Josh
SouthwaterDave
09-29-2007, 10:00 AM
The ASP.NET TextBox control is rendered on a client browser as <input type="text"> or <textarea>. To render a <textarea> just code the TextMode property appropriately, e.g.,<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine">
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.