开发者

<asp: > vs <input> Sending an email to user input email. ASP.NET VB

I have 2 pages, one is HTML and the other is ASPX. In the HTML I am able to get input from a user and then process a return email to them. The HTML looks like this:

<input type="text" class="input" value="e-mail" id="txtEmail" name="contactEmail" onclick="SelectAll('txtEmail');" >

and I'm using the following in the method

Dim sResponseToName As String = Request.Params("contactEmail").ToString

This part of my page works perfect as someone sends me a request I am about to direct an email to their "contactEmail"

However, in my aspx page it looks like this:

<asp:TextBox ID="contact_Email" CssClass="inputtext1" runat="server">

and the method used is:

Dim sResponseToName As String = Request.Params("contact_Email").ToString()

but no email is sent to the input email address.... If I hard code a random email instead of Request.Params("contact_Email").ToString() it works fine. But for some reason I can not get to the inputted user address.

kinda stumped, I've tried a few things but no luck. How 开发者_C百科do I get the Request.Params to work in an aspx, and do I need to add something in <asp:TextBox....> to reference it.

Please help, thanks in advance.


The beauty of making the asp:TextBox a server control is that, within the server code, you have access to the actual object. So there's no need to deal with the request parameters, you can just access the TextBox object:

Dim sResponseToName As String = contact_Email.Text


You have to reference the TextBox object like this:

Dim sResponseToName As String = contact_Email.Text
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜