• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 350
  • Last Modified:

code behind

Hi,

Please assist where do I type this code in?
    Protected WithEvents HG1 As DBauer.Web.UI.WebControls.HierarGrid

The website says it should go in code behind,  I'm using Visual Web Dev 2005 Express edition, which can only edit aspx pages. where in both code and html are in one page.

Thanks.
   
In reference too:

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 46:     Private Sub HG1_TemplateSelection(ByVal sender As Object, _
Line 47: ByVal e As HierarGridTemplateSelectionEventArgs) _
Line 48: Handles HG1.TemplateSelection
Line 49:         e.TemplateFilename = "Template\\Sup.ascx"
Line 50:     End Sub
Source File: c:\inetpub\wwwroot\test.aspx    Line: 48
0
RyanBank
Asked:
RyanBank
  • 2
1 Solution
 
Edwin_CCommented:

Public Class test  Inherits System.Web.UI.Page

Protected WithEvents HG1 As DBauer.Web.UI.WebControls.HierarGrid

Private Sub Page_Load( ....

Hope that helps
0
 
RyanBankAuthor Commented:
Edwin_C

When I added the ode the following error occured:

<script runat="server">
Public Class hourly  Inherits System.Web.UI.Page
        Protected WithEvents HG1 As DBauer.Web.UI.WebControls.HierarGrid



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: BC30456: '__control2' is not a member of 'ASP.test_aspx.test'.
Source Error:
Line 1:  <%@ Register TagPrefix="DBWC" Namespace="DBauer.Web.UI.WebControls" Assembly="DBauer.Web.UI.WebControls.HierarGrid" %>
Line 2:  <%@ Page Language="vb" AutoEventWireup="true" Debug="true" %>
Line 3:  <%@ import Namespace="System.Data" %>
Source File: c:\inetpub\wwwroot\test.aspx    Line: 1
0
 
RyanBankAuthor Commented:
I got it, i remove the sub and double click the control it generated the right sub
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now