423,834 Members | 1,348 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,834 IT Pros & Developers. It's quick & easy.

SMTP form errors

P: 49
Hello

I am getting 2 red underlines in this portion of code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim robots As String

robots = Request.Form("robots")

If robots <> "" Then

Response.Write("No spambots here!")
Else
'Process the form...
End If

LblDate.Text = ReturnDate()

user_name.Focus()

Dim robots As String

I have a label called

Expand|Select|Wrap|Line Numbers
  1.  <asp:Label ID = "LblDate" runat="server" CssClass="dateStyle" Text="Label"></asp:Label>
in my aspx page.

user_name (the name of my TextBox) is not declared. What would I declare user_name as, please, because Focus() is not a member of String?

Thank you
Dec 5 '17 #1
Share this Question
Share on Google+
2 Replies


Frinavale
Expert Mod 5K+
P: 9,731
Consider using a redirect for your first condition.

Response.Write will insert the text you have into some point in the HTML which typically generates invalid HTML.

For example, it could (and likely would) insert your message into the HTML above the opening <html> tag for your page.

As for the Focus problem: please remember that VB.NET code is executed on the server and "focusing" on a field is something that needs to be done by the web browser after the HTML for the element is rendered in the web browser.

You will likely need to implement some JavaScript to focus on the input element (the text box) that you want to focus on.
Dec 5 '17 #2

P: 49
Thank you for your attentive replies.

I will go through what you have said and post back soon.
Dec 5 '17 #3

Post your reply

Sign in to post your reply or Sign up for a free account.