Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Protection level error

Status
Not open for further replies.

Terpsfan

Programmer
Joined
Dec 8, 2000
Messages
954
Location
US
One the following code I'm getting this error: Thanks for any help in fixing this.

Compiler Error Message: CS0122: 'Work.Review.button_click(object, System.Web.UI.WebControls.CommandEventArgs)' is inaccessible due to its protection level


<asp:Button ID=&quot;btnBorrowerInfo&quot; OnCommand=&quot;button_click&quot; CommandName=&quot;borrowerInfo&quot; text=&quot;Borrower Info&quot; Runat=&quot;server&quot; />
<asp:Button ID=&quot;btnAppraisal&quot; OnCommand=&quot;button_click&quot; CommandName=&quot;appraisal&quot; Text=&quot;Appraisal&quot; Runat=&quot;server&quot; />
<asp:Button ID=&quot;btnTitle&quot; OnCommand=&quot;button_click&quot; CommandName=&quot;title&quot; Text=&quot;Title&quot; Runat=&quot;server&quot; />
<asp:Button ID=&quot;btnSubmit&quot; Text=&quot;Submit&quot; Runat=&quot;server&quot; />

private void button_click (object sender, System.Web.UI.WebControls.CommandEventArgs e)
{
if (e.CommandName == &quot;borrowerInfo&quot;)
{
pnlName.Visible = false;
pnlPhone.Visible = false;
pnlAddress.Visible = true;
}
else if (e.CommandName == &quot;appraisal&quot;)
{
pnlPhone.Visible = false;
pnlAddress.Visible = false;
pnlName.Visible = true;
}
else if (e.CommandName == &quot;title&quot;)
{
pnlAddress.Visible = false;
pnlName.Visible = false;
pnlPhone.Visible = true;
}
}
 
I figured it out, I had to use the button_click method with public scope, as in public void.... Maybe someone can explain why I had to use public scope...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top