|
-
Feb 7th, 2003, 01:05 PM
#1
Thread Starter
Frenzied Member
label and onclick
I wish to fire an onclick event when I click a label. But it fails. It's fine if I use a button. I am rewriting my javascript menus to .net code. Or does any have a better solution? I wish to activate a .net sub when I click a JS-menu.
Code:
<%@ Page Language="VB" %>
<script runat="server">
Sub panelhp(sender As Object, E As EventArgs)
lblHp.text = "Test"
end sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:label id="Label1" onclick="panelhp" runat="server" text="Test"></asp:label>
<asp:label id="lblHp" runat="server" text="Help"></asp:label>
</form>
</body>
</html>
-
Feb 7th, 2003, 10:38 PM
#2
PowerPoster
I am not that good with ASP.Net yet, but I think in VB.Net code you need to put a handles statement at the end of the sub:
VB Code:
Sub panelhp(sender As Object, E As EventArgs) Handles lblHp.Click 'or something like that....
lblHp.text = "Test"
end sub
-
Feb 10th, 2003, 12:40 PM
#3
Member
I don't think ASP labels have click events associated with them. You'll have to use a button, hyperlink, or something similar available for web forms...
Ooogs
-
Feb 10th, 2003, 03:22 PM
#4
New Member
hpl, you can not assign any action on a label control...
greetz,
Tim
-
Feb 11th, 2003, 02:10 AM
#5
Thread Starter
Frenzied Member
OK, so I have to use a button and the hide the borderwidths? I have also tried to use this
<asp:hyperlink ..../>. Can anyone give an example with onclick used with a hyperlink? I can't make it work, perhaps I use some events, which are not allowed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|