.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

why do i get

BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.

with the code

 below ..thanks


<form id="form1" runat="server">
               <asp:Button ID="Button1" runat="server" Text="Run Access" />
In your code behind:


View Complete Post

More Related Resource Links

The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must



This is frustrating, and I don't know how to solve it.

I have a strange problem. I am adding a LinqDatasource object, and set the context:

        protected void LinqDataSource_ContextCreating(object sender, LinqDataSourceContextEventArgs e)
            e.ObjectInstance = new KaruselaDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

Then I get this error:
The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.


On web.config I already have this:
<add assembly="System.Data.Linq, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

NOTE: The datacontext is in a different project (DLL proect) where I added a refernce to System.Data.Linq.

is there another way adding a refernce to a web project? or only though teh web.config?


"Type ASP.x is not defined" error for dynamic user control when publishing updateable


I have a user control (ContainerCtrl) which programmatically instantiates another user control (SimpleCtrl) in OnLoad. It builds and runs fine, but when I publish it I get the error "error BC30002: Type 'ASP.SimpleCtrl' is not defined." (If I publish without the "updateable" option there's no error, but I need the site to be updateable.)

I assume this has to do with the particulars of how the assembly(ies) are built for the different compiler options. My question is, how can I get it to work properly for "updateable" publishing?

VS 2008 / .NET 3.5 sp1

The code follows (web.config is the default from Visual Studio).

Many thanks, Dave


<%@ Control Language="VB" ClassName="SimpleCtrl" CodeFile="SimpleCtrl.ascx.vb" Inherits="_SimpleCtrl" %>

    Simple control


Partial Class _SimpleCtrl
    Inherits UserControl

    'Nothing to see here.

End Class


<%@ Control Language="VB" CodeFile="ContainerCtrl.ascx.vb" Inherits="_ContainerCtrl"

Function and Variable declaration with out an 'As' clause


I get a message - "Function without an 'As' clause" for HMAC_MD5 and "Variable declaration without an 'As' clause" for Key and Value.  But the code works.  But the messages still exists.  Is there a way to fix this to avoid the messages?

Function HMAC_MD5(ByVal Key, ByVal Value)


Creating a table-valued function on a user defined type in SQL Server CLR

We would like to be able to create a table-valued function on a user defined type.  We would like the syntax in SQL to look like it works for the XML nodes function:   DECLARE @myXml XML = '<a><b>1</b><b>2</b><b>3</b></a>' ; SELECT  node.query('text()') FROM    @myXml.nodes('a/b') nodes (node) ;   In other words, in the FROM clause, we can access the "nodes" method of the xml variable and it returns a rowset. Thanks!

User Defined Data Type - using SMO *** NEED HELP ! ***

Hi,Is it possible to script out the User Defined Data Types via SMO in .NET and specifically VB.Net?  I have not been able to find some examples on how to do this.  If you have some experience with this, pleasepost some examples or provide links where I can find this information.Thank you in advance.-Sydney

how to include a user defined table type as input for stored procedure

Hi ,  I have a user defined table type which i need to pass as input parameter to the stored procedure .How can i do that?

Variable/Argument Type List

Hi I wish to restrict or supply my own list of (Variable/Argument) types to a rehosted Workflow Designer. Is this definatley not possible? I have read http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/53c91c81-02cf-4eab-b43f-c3d73a03c501, where it appears it is not. I find it difficult to believe I cannot get some sort of control of how these drop downs are populated. Could someone please confirm categorically that this is or is not possible. Regards DarremDarren

Java - Type not defined error with ReportViewerWebControl.axd

I've been searching for several days now looking for threads / solutions in regards to a Report Viewer Problem. OS - Windows Server 2008 all updates installed DN FW - 3.5SP1 and 4.0 ReportViewer.exe was and is installed (Version 10.0.30319.1) The ReportViewer Assemblies are in the GAC The project is a Visual Studio 2010 project The application is running in it's own App Pool with the 4.0 framework in integrated mode In order to pin this down I have reduced a test project to an empty page with a Report Viewer Control and a Button. There is no DataSource and no report associated with the viewer, just the empty viewer control. The web application runs without errors on my dev box and on a new test environment (with the Web Server in a VM) that I set up to test with. When I deploy to our test or staging servers the page fails with Java Script errors. The error that is the root cause is "Type is undefined" which is referring to Reserved.ReportViewerWebControl.axd.  When using the developer tools for IE the script is loaded but fails at Line 1 of the script Type.registerNamespace("Microsoft.Reporting.WebFormsClient"); with the message Type is undefined.   'Type' ist undefiniert  Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=10.0.30319.1&Name=ViewerScript, Zeile 1 Zeichen 1 When I call the ReportViewerWebCont

Warning WithEvents variable, how do i declare shadow?

I get this warning , how do i overcome it. I have a grid veiw on a form with one of my rows  called Location.                                                        thanks rob Warning 1 WithEvents variable 'Location' conflicts with property 'Location' in the base class 'Form' and should be declared 'Shadows'. rh

missing event Handles variable

There is a missing event Handles variable found in the VB button code.What is the missing variable? Here is the code:Imports System.Data Imports System.Data.SqlClient Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click ' strLong Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("DB_13299_applicationConnectionString").ToString()) Try Dim cmd As SqlCommand = conn.CreateCommand() cmd.CommandText = "INSERT INTO Application ( First, Last, City, State) VALUES (@First, @Last, @City, @State);" cmd.Parameters.Add(New SqlParameter() With { _ .ParameterName = "@First", _ .DbType = SqlDbType.NVarChar, _ .Value = First.Text _ }) cmd.Parameters.Add(New SqlParameter() With { _ .ParameterName = "@Last", _ .DbType = SqlDbType.NVarChar, _ .Value = Last.Text _ }) cmd.Parameters.Add(New SqlParameter() With { _ .ParameterName = "@City", _ .DbType = SqlDbType.NVarChar, _ .Value = City.Text _ }) cmd.Parameters.Add(New SqlParameter() With { _

Large amount of handles of type token using role manager and authorisation manager (azman)

First you'll need some background on the application.  ASP.net application using .net framework 3.5. Security to the application is controlled with impersonation, using a role manager connecting to an azman store which uses Active Directory groups for security. As demoed in the following msdn link ... http://msdn.microsoft.com/en-us/library/ff649313.aspxAfter 50 or so users access the application throughout the day, eventually the application stops responding or users start to experience images not displaying etc and the application pool has to be recycled (typical symptoms of the server running out of memory).  Looking at the application memory usage and available memory on the server this does not appear to be the issue, investigations so far have lead me to think this is to do with Security Token Handles.  I've used process explorer to monitor the asp.net application and handles for the application steadily increase with every page that is accessed and eventually hit 38,000 this is when the application dies.  I've read various links saying that applications should use between 2,000-10,000 handles and any number near 40,000 makes the application unusable (this is the exact behaviour we are experiencing).  Using process explorer and handle.exe from the windows sysinternals site I

Error: "Type 'System.Web.UI.UpdatePanel' is not defined"?

Can anybody tell me why I'm getting this error on the first line of all my aspx pages? The lines have a blue squiggly line underneath them:<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> Error: Type 'System.Web.UI.UpdatePanel' is not defined 

Get inserted ids when inserting from User Defined Table Type

Imagine this procedure:   CREATE PROCEDURE [dbo].[insertActive] ( -- Add the parameters for the stored procedure here @p_data dbo.activeUpdate readonly) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. insert into dbo.active (name,stateid) select name,stateid from @p_data END How can I get the ids of the rows that have been inserted?  I tried searching the net and the forums but could not find anything. Thanks for any and all help, Gareth.

SSIS User Defined Data Type (Alias Data Types) and OLE DB Command validation

Hello everyone, I've been having an issue with trying to run my SSIS package on a server, and it seems to be failing on the OLE DB Command step.  What we have in our SQL 2005 DB, is a User-Defined Data Type (base type char(7)) and the OLE DB Command is supposed to call a proc that passes in a value of this data type. ie:  CREATE PROCEDURE myProcedure ( @passedInFromSSIS MY_DATATYPE ) AS .... In my SSIS package, I have the type defined as DT_STR with a length of 7.  Now, when I run the package locally (via Visual Studio), the process runs with success.  However, once the package is deployed on a server and run from an application (note: it is run under a different user), the process fails on a validation step with a "Invalid Parameter Number" error. Now, if I change the input parameter in my proc to the base type of the user-defined data type, the process works again. Has anybody run into a similar issue or know what may be causing this issue?  I first suspected perhaps I needed to grant permissions on the user-defined data type (since I was able to run it under my security context, but not under the application's), however noticed that there isn't security tied to the types.  Any other thoughts?  Please let me know if you need further explanation.  Thanks!

What type variable can I use to assign a possible Null or a string to?



I am converting a VB6 app to VB2008 and are having problems with replacing Variant variables.

I used Variant in cases where the data might be string or Null.

Is there a way I could check for Null and just set the string to zero lenght?

Any help would be appreciated.



A new expression requires (), [] or {} after type ??

Hello - I am fairly new to C# and I am having trouble with a line of code highlighted below. I get a
error: "A new expression requires (), [] or {} after type" Can someone help? Thanks
namespace BackgrountPrint
 class Program

       public BackgroundPrint.ReportService.ReportingService rs;
        public BackgroundPrint.ReportExecution2005.ReportExecutionService   rsExec;

        static void Main(string[] args)

           ReportService.ReportingService rs = new BackgroundPrint.ReportService.ReportingService

           rs.Credentials = CredentialCache.DefaultCredentials ;



SSIS 2008-Variable Expression Type Cast Syntax Error


Hi all members.

I need to ask for the following code. I need to convert the variable into a string.

"Select Distinct convert (int ,A.CustomerCategory) as AccountReceivableCategoryID, convert (varchar(40), B.Text) as AccountReceivableCategoryNameE
from Inkunde A , inpara B
where A.CustomerCategory= B.SearchItem
and B.Language1 = 'EN'
and B.ParameterName = 'CATEGORY'
and A.CustomerCategory = (DT_STR,200,1252) "+  @[User::CategoryID] +"
Order By A.CustomerCategory"

Kindly any member let me know, How to correctly use the Type Cast fucntion in variables

Thanks and Best Regards,


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend