Update to VS2005

W

WO70

Hi NG,

I converted a VS2003 ASP.NET solution to ASP.NET 2 and got 2 Errors
like this:
ERROR: The member declaration for 'reqValEdit' was removed and its
accessibility has been changed from 'public' to 'protected'. To access
this member from another page you should create a public accessor
property for it. editor\FrageEdit.aspx.cs

I read something about the new code behind model, but I was wondering
if there is no way to change the access modifier of a WebControl.
Should I do it like (below) this now, to access a WebControl from
another Page?

- Add a TextBox with ID _TextBox1 in Designer View.
- In Codebehind add a Property like this:
public System.Web.UI.WebControls.TextBox TextBox1
{
get
{
return _TextBox1;
}
}

thx in advance
Bjoern
 
S

S.M. Altaf [MVP]

Why not just go in and physically change it back from protected to public?




--------------------------------------------------------------------------------

All that glitters has a high refractive index.
www.mendhak.com

Hi NG,

I converted a VS2003 ASP.NET solution to ASP.NET 2 and got 2 Errors
like this:
ERROR: The member declaration for 'reqValEdit' was removed and its
accessibility has been changed from 'public' to 'protected'. To access
this member from another page you should create a public accessor
property for it. editor\FrageEdit.aspx.cs

I read something about the new code behind model, but I was wondering
if there is no way to change the access modifier of a WebControl.
Should I do it like (below) this now, to access a WebControl from
another Page?

- Add a TextBox with ID _TextBox1 in Designer View.
- In Codebehind add a Property like this:
public System.Web.UI.WebControls.TextBox TextBox1
{
get
{
return _TextBox1;
}
}

thx in advance
Bjoern
 
B

Bruce Barker

it a little more complicated than that.

in 1.0/1.1 the aspx page inherited from the codebehind page. this meant if
the control was defined in the codebehind, its defination was used.

in 2.0 the code behind is a partial class (as is the aspx code). the
controls variables are now defined in the aspx page only, so you cannot
override them in the code behind.

your solution is the correct one.

-- bruce (sqlwork.com)
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top