473,406 Members | 2,293 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,406 software developers and data experts.

Code Behind protection level error

I'm working my way throught ASP Resource Kit tutorial lab 3. This following
code was working in the HTML page:

private void btnSignIn_Click(object sender, System.EventArgs e)
{
// Add user authentication logic here
if (txtUserId.Text.Length >= 4 && txtPassword.Text.Length >= 4 &&
txtUserId.Text.StartsWith("J"))
{
lblResult.Text = "Valid User!";
}
else
{
lblResult.Text = "Invalid User!";
}
}

until I put in in the code behind file in VS.NET now I get the error:
Compiler Error Message: CS0122:
'Lab3_VBCS_Starter.WebForm1.btnSignIn_Click(object , System.EventArgs)' is
inaccessible due to its protection level

Any advice what I'm doing wrong?

regards
Ken

Nov 18 '05 #1
1 4145
Method access modifier for btnSignIn_click method should be either protected
or public. This error is coming because your code behind file clas and aspx
page class are differenct class. So it couldnt access the methods in other
class as it is private. If it is in same class you wont get this error.

To know more about code behind, check out this link
http://support.microsoft.com/default...B;EN-US;303247

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Ken.r" <Ke**@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
I'm working my way throught ASP Resource Kit tutorial lab 3. This following code was working in the HTML page:

private void btnSignIn_Click(object sender, System.EventArgs e)
{
// Add user authentication logic here
if (txtUserId.Text.Length >= 4 && txtPassword.Text.Length >= 4 &&
txtUserId.Text.StartsWith("J"))
{
lblResult.Text = "Valid User!";
}
else
{
lblResult.Text = "Invalid User!";
}
}

until I put in in the code behind file in VS.NET now I get the error:
Compiler Error Message: CS0122:
'Lab3_VBCS_Starter.WebForm1.btnSignIn_Click(object , System.EventArgs)' is
inaccessible due to its protection level

Any advice what I'm doing wrong?

regards
Ken

Nov 18 '05 #2

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

Similar topics

1
by: Jaweed | last post by:
Hi I'm developing an ASP.NET app in Visual studio (using C# for code behind). My question is fairly simple (i think). When I go to the code behind page, the controls in the html page are made...
1
by: Larry | last post by:
I have a VB background and am developing a new windows app in Csharp. I'm getting the error. 'inaccessible due to its protection level' I've added a TextBox1 and a Button1 to a form. I...
6
by: Beat | last post by:
Is it possible to reference the same codebehind from 2 different pages? It would be an elegant solution, where we do need different settings at the PAGE-Level for 2 user-Groups but the rest of...
3
by: xenophon | last post by:
This following innocuous code: System.IO.DirectoryInfo fff = new System.IO.DirectoryInfo(); System.IO.FileInfo ppp = fff.GetFiles( Request.MapPath(".") ); for( int ccc=0 ; ccc < ppp.Length ;...
2
by: sck10 | last post by:
Hello, I am getting the following error: fvServiceIdea_ItemUpdating_Validate(object, System.Web.UI.WebControls.FormViewUpdateEventArgs)' is inaccessible due to its protection level. Below...
0
by: tshad | last post by:
I have the following event called from my DataGrid to my Code-Behind file. I am using VS 2003 private void articleList_DeleteFile(Object sender, DataGridCommandEventArgs e) { //First, get the...
6
by: milund | last post by:
I have a "funny" after upgrading to .NET2.0. The following code is placed inside an unsafe method in assembly "A" System.Object myIUnknownObject =...
0
by: KhoaNguyen | last post by:
Hi, When i compiled these two source files, it gives me an error saying: Inaccesssible Due to its protection level. ------------Base Class----------------- using System; using...
7
by: tshad | last post by:
I am getting a "Protection Level Error" when I access a private variable (numberOfEngines) from my subclass SingleEnginePlane. If I set it as public I can access it directly from my object in my...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.