Compiler Error Message: BC30506: Handles clause requires a WithEvents variable.

Posted on 2006-06-06
Last Modified: 2008-01-09

Please assist how can we resolve the error? I'm using visual web developer 2005 express edition.

referece too

scroll down to:
3.7 Using the TemplateSelection event


Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30506: Handles clause requires a WithEvents variable.
Source Error:
Line 57:     End Function
Line 58:
Line 59:     Private Sub HG1_TemplateSelection(ByVal sender As Object, ByVal e As DBauer.Web.UI.WebControls.HierarGridTemplateSelectionEventArgs) Handles HG1.TemplateSelection
Line 60:         e.TemplateFilename = "Templates\\" + e.Row.Table.TableName + ".ascx"
Line 61:     End Sub
Source File: c:\inetpub\wwwroot\test.aspx    Line: 59
Question by:RyanBank
    LVL 96

    Accepted Solution

    Look where HG1 is defined, and it show that, please.


    Author Comment

    <%@ Page Language="vb" AutoEventWireup="false" %>
    <%@ Register TagPrefix="DBWC" Namespace="DBauer.Web.UI.WebControls" Assembly="DBauer.Web.UI.WebControls.HierarGrid" %>
    <%@ import Namespace="System.Data" %>
    <%@ import Namespace="System.Data.SqlClient" %>
    <script runat="server">

                &nbsp;<DBWC:HierarGrid ID="HG1" runat="server" TemplateDataMode="Table">
    LVL 96

    Expert Comment

    by:Bob Learned
    What version of the HierarGrid do you have?  Is it the latest?


    Author Comment



    Author Comment

    I got it to work, place a comment on the code below.
    'Handles HG1.TemplateSelection

    can you kindly assist on this please:

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now