Code Behind protection level error

G

Guest

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
 
S

Saravana

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.aspx?scid=KB;EN-US;303247
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top