majic87
Newcomer
I've created a simple .aspx page with a textbox and a label. I want to change the value in the label each time a user moves the mouse over the textbox.
I have created a procedure to update the counter value (by adding 1 to the current counter value).
I can call this procedure from OnTextChanged and the label will display the result from the procedure (although the counter doesn't increase...yet). However, if I try to use OnMouseOver, I get the following message: Error: 'tbCodeTextChangedByCode_mouseover' is undefined.
Why is this error generated for OnMouseOver, but not for OnTextChanged, and how do I make it work (or at least have the procedure called from OnMouseOver)? Please keep in mind that I am very new to asp.net.
Thank you.
This is the code from my page:
<%@ Page Language="VB" %>
<script runat="server">
Class SimpleCounter
public x as integer
public y as integer
sub SetInitialXValue(obj as object, e as eventargs)
x=1
y=1
end sub
end Class
sub tbCodeTextChangedByCode_MouseOver(sender As Object, e as eventargs)
dim objSimpleCounter as new SimpleCounter
objSimpleCounter.y = objSimpleCounter.x + 1
lblMouseOverUpdateField.text = "Changed Via Code to : " + CSTR(objSimpleCounter.x) + " + 1 = " + CSTR(objSimpleCounter.y)
objSimpleCounter.x = objSimpleCounter.x + 1
end sub
</script>
<html><body>
<form runat="server">
<asp:textbox id="tbTextChangedByCode" runat="server"
OnTextChanged="tbCodeTextChangedByCode_mouseover"
OnMouseOver="tbCodeTextChangedByCode_mouseover">
</asp:textbox><hr>
<asp:label id="lblMouseoverUpdateField"
runat="server"/><hr>
</form>
</body></html>
I have created a procedure to update the counter value (by adding 1 to the current counter value).
I can call this procedure from OnTextChanged and the label will display the result from the procedure (although the counter doesn't increase...yet). However, if I try to use OnMouseOver, I get the following message: Error: 'tbCodeTextChangedByCode_mouseover' is undefined.
Why is this error generated for OnMouseOver, but not for OnTextChanged, and how do I make it work (or at least have the procedure called from OnMouseOver)? Please keep in mind that I am very new to asp.net.
Thank you.
This is the code from my page:
<%@ Page Language="VB" %>
<script runat="server">
Class SimpleCounter
public x as integer
public y as integer
sub SetInitialXValue(obj as object, e as eventargs)
x=1
y=1
end sub
end Class
sub tbCodeTextChangedByCode_MouseOver(sender As Object, e as eventargs)
dim objSimpleCounter as new SimpleCounter
objSimpleCounter.y = objSimpleCounter.x + 1
lblMouseOverUpdateField.text = "Changed Via Code to : " + CSTR(objSimpleCounter.x) + " + 1 = " + CSTR(objSimpleCounter.y)
objSimpleCounter.x = objSimpleCounter.x + 1
end sub
</script>
<html><body>
<form runat="server">
<asp:textbox id="tbTextChangedByCode" runat="server"
OnTextChanged="tbCodeTextChangedByCode_mouseover"
OnMouseOver="tbCodeTextChangedByCode_mouseover">
</asp:textbox><hr>
<asp:label id="lblMouseoverUpdateField"
runat="server"/><hr>
</form>
</body></html>