arthurh88
asked on
ASP.NET 4.5, VS2013: Get Input Type = Email in VB code behind
I simply want a way in my code behind (i'm using visual basic) to grab the value of this field:
<input id="email" type="email" placeholder="Your email adress" runat="server">
But I dont know how?
Response.Write(email.Value ) does not work.
VS 2013 on .NET 4.5 and IIS 7 .
Any help?
<input id="email" type="email" placeholder="Your email adress" runat="server">
But I dont know how?
Response.Write(email.Value
VS 2013 on .NET 4.5 and IIS 7 .
Any help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes.
and code behind will be
<input id="email" runat="server" type="Email" Placeholder="Mail Address"/>
and code behind will be
Response.Write(this.email.Value);
ASKER
says "email is not a member" that is essentially what i tried. i dont think its recognizing type=email, which is valid HTML5. It will only work if type is text
I have a working example of this code it is working just fine. Can you post your pages? Also are you getting any other error?
ASKER
i can't post my page because it wont compile. but the aspx code is this:
<input id="name" type="text" placeholder="Your name" runat="server">
<input id="email" type="email" placeholder="Your email adress" runat="server">
That page is fine, no errors. the error is on the codebind with this line:
Public Class _004contact
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Write(name.Value)
Response.Write(Me.email.Va lue) ' ERROR IS HERE
End Sub
End Class
The error says:
"Error 174 'email' is not a member of 'ther2._004contact'.
<input id="name" type="text" placeholder="Your name" runat="server">
<input id="email" type="email" placeholder="Your email adress" runat="server">
That page is fine, no errors. the error is on the codebind with this line:
Public Class _004contact
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Write(name.Value)
Response.Write(Me.email.Va
End Sub
End Class
The error says:
"Error 174 'email' is not a member of 'ther2._004contact'.
ASPX code can't be just these two lines. It generally has page level directives, valid HTML and BODY tags then Form tags and within the form tag you will put in your controls. Or have you put codebehind on the same page?
ASKER
i didn't post the entire aspx page, that wouldn't be relevant. the aspx code I quoted is inside
<form id="form1" runat="server">
the head line says:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="004contact.asp x.vb" Inherits="ther2._004contac t" %>
<form id="form1" runat="server">
the head line says:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="004contact.asp
ASKER
there are no errors in the aspx page. it is fine. the moment i take out the VB line of code it works great.
ASKER
Response.Write(name.Value) = WORKS FINE
Response.Write(email.Value ) = DOES NOT WORK
Response.Write(email.Value
Try
<input id="name" type="text" placeholder="Your name" runat="server"/>
<input id="email" type="email" placeholder="Your email adress" runat="server"/>
ASKER
that doesn't work. I have simplified everything:
and
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<input id="name" type="text" placeholder="Your name" runat="server"/>
<input id="email" type="email" placeholder="Your email adress" runat="server"/>
</form>
</body>
</html>
and
Partial Class test
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Response.Write(name.Value)
Response.Write(email.Value)
End Sub
End Class
ASKER
i figured out how to get my stylesheets and scripts to work on an <ASP> textbox control, so I found a way around it. thanks for trying to help me :)
ASKER
this is pretty much what i ended up doing
ASKER