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
 
Ad

Advertisements

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
 

Top