473,396 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Codebehind Events not working

I know it's probably my code but I don't seem to be able to get OnClick
events to tie up. The OnLoad and other standard events will fire but not a
button onclick. Here's a sample of what i'm trying to do..

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="newhist.aspx.vb"
Inherits="History.newhist"%>
<HTML>
<HEAD>
<LINK href="Styles.css" type="text/css" rel="STYLESHEET">
</HEAD>
<BODY>
<form id="frmNewHistory" method="post" runat="server">
<asp:TextBox id="txtWork" runat="server" Width="240px"
Height="112px"></asp:TextBox>
<asp:Button id="cmdEnter" runat="server" Text="Enter"
OnClick="EnterData"></asp:Button>
</form>
</BODY>
</HTML>

using the code behind of...

Public Class newhist
Inherits System.Web.UI.Page
Protected WithEvents txtWork As System.Web.UI.WebControls.TextBox
Protected WithEvents cmdEnter As System.Web.UI.WebControls.Button

Public Sub EnterData(ByVal Sender As Object, ByVal e As EventArgs)
Handles cmdEnter.Click
Dim obHistory As New History.History
obHistory.AddHistory(txtWork.Text)
txtWork.Text = "Done"
End Sub
End Class

The error I get is "Compiler Error Message: BC30456: 'EnterData' is not a
member of 'ASP.newhist_aspx'."

Is there anything obvious that i'm doing wrong?

Cheers,

<M>ike
Nov 18 '05 #1
2 7327
Mike,

Seems you are missing a namespace declaration in the code behind. May be the
"History" namespace is assumed by default in the VB ASP .NET project, but
you'd better check that.

I also have a feeling that since you've already specified the Handles
modifier in the code-behind, you might want to try to remove the "OnClick"
attribute in the ASPX file.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Mike Dinnis" <mike dot dinnis at abraxas-uk dot com> wrote in message
news:eM**************@TK2MSFTNGP11.phx.gbl...
I know it's probably my code but I don't seem to be able to get OnClick
events to tie up. The OnLoad and other standard events will fire but not a
button onclick. Here's a sample of what i'm trying to do..

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="newhist.aspx.vb" Inherits="History.newhist"%>
<HTML>
<HEAD>
<LINK href="Styles.css" type="text/css" rel="STYLESHEET">
</HEAD>
<BODY>
<form id="frmNewHistory" method="post" runat="server">
<asp:TextBox id="txtWork" runat="server" Width="240px"
Height="112px"></asp:TextBox>
<asp:Button id="cmdEnter" runat="server" Text="Enter"
OnClick="EnterData"></asp:Button>
</form>
</BODY>
</HTML>

using the code behind of...

Public Class newhist
Inherits System.Web.UI.Page
Protected WithEvents txtWork As System.Web.UI.WebControls.TextBox
Protected WithEvents cmdEnter As System.Web.UI.WebControls.Button

Public Sub EnterData(ByVal Sender As Object, ByVal e As EventArgs)
Handles cmdEnter.Click
Dim obHistory As New History.History
obHistory.AddHistory(txtWork.Text)
txtWork.Text = "Done"
End Sub
End Class

The error I get is "Compiler Error Message: BC30456: 'EnterData' is not a
member of 'ASP.newhist_aspx'."

Is there anything obvious that i'm doing wrong?

Cheers,

<M>ike


Nov 18 '05 #2
Ah,

Found it. I hadn't compiled the code sfter making the amendments.

Sorry!

<M>ike

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:e4**************@TK2MSFTNGP11.phx.gbl...
Mike,

Seems you are missing a namespace declaration in the code behind. May be the "History" namespace is assumed by default in the VB ASP .NET project, but
you'd better check that.

I also have a feeling that since you've already specified the Handles
modifier in the code-behind, you might want to try to remove the "OnClick"
attribute in the ASPX file.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Mike Dinnis" <mike dot dinnis at abraxas-uk dot com> wrote in message
news:eM**************@TK2MSFTNGP11.phx.gbl...
I know it's probably my code but I don't seem to be able to get OnClick
events to tie up. The OnLoad and other standard events will fire but not a button onclick. Here's a sample of what i'm trying to do..

<%@ Page Language="vb" AutoEventWireup="false"

Codebehind="newhist.aspx.vb"
Inherits="History.newhist"%>
<HTML>
<HEAD>
<LINK href="Styles.css" type="text/css" rel="STYLESHEET">
</HEAD>
<BODY>
<form id="frmNewHistory" method="post" runat="server">
<asp:TextBox id="txtWork" runat="server" Width="240px"
Height="112px"></asp:TextBox>
<asp:Button id="cmdEnter" runat="server" Text="Enter"
OnClick="EnterData"></asp:Button>
</form>
</BODY>
</HTML>

using the code behind of...

Public Class newhist
Inherits System.Web.UI.Page
Protected WithEvents txtWork As System.Web.UI.WebControls.TextBox
Protected WithEvents cmdEnter As System.Web.UI.WebControls.Button

Public Sub EnterData(ByVal Sender As Object, ByVal e As EventArgs)
Handles cmdEnter.Click
Dim obHistory As New History.History
obHistory.AddHistory(txtWork.Text)
txtWork.Text = "Done"
End Sub
End Class

The error I get is "Compiler Error Message: BC30456: 'EnterData' is not a member of 'ASP.newhist_aspx'."

Is there anything obvious that i'm doing wrong?

Cheers,

<M>ike

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ECatz | last post by:
I've got the following line in my .aspx file... <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="SampleVB.WebForm1"%> The problem is, it doesn't seem to...
9
by: Marek Mand | last post by:
How to use generated keyboard events? What I am trying here to do is in onkeyup event handler http://www.hot.ee/idaliiga/braggart/createEventTest.htm generate a (shift)TAB keydown so the...
1
by: Mark Szlazak | last post by:
Is there a way to detect if an textarea onscroll event is working in Firefox (or Mozilla). I know that there is an onscroll event bubbling bug with current vesions of these browsers so I want to...
2
by: Jeff Van Epps | last post by:
We've been unable to get events working going from C# to VJ++. We think that the C# component is being exposed properly as a ConnectionPoint, and the Advise() from the VJ++ side seems to be...
9
by: Dave Kelly | last post by:
I have generated a class, which contains configuration data for my application. Unfortunately I cannot use a static implementation of the class, as it requires a constructor. I generate...
6
by: ankurw | last post by:
Hi All, I am experiencing a frustrating issue with hooking into COM events from a Windows service writting in C#. I create a COM object in the service and hook into an event exposed by the...
1
by: Earl Teigrob | last post by:
I have a DataGrid that needs to set many properites on its embeded controls in the ItemTemplate and EditItemTemplate Templates. I have a choice between using the inline <%# %> or the OnItemCreated...
0
by: samir dsf | last post by:
hi i thinks its a very strange problem.I had been running my file ServerList2.aspx and i see the output(when i do f5). i am using this file serverList2.aspx on hte left side of a main page (using...
30
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.