Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Error parsing attribute 'test': Type 'System.Web.UI.Page' does not have a public property named 'test'.

Reply
Thread Tools

Error parsing attribute 'test': Type 'System.Web.UI.Page' does not have a public property named 'test'.

 
 
Bob
Guest
Posts: n/a
 
      02-08-2008
I am getting this error when trying to use a custom property in my page
directive:

Error parsing attribute 'test': Type 'System.Web.UI.Page' does not have a
public property named 'test'.

What am I doing wrong?

Thanks

===========================================
default.aspx
===========================================
<%@ Page Language="C#" CodeFile="mycorp.page.cs" Inherits="MyCorp.Page"
Test="abc" %>
<HTML>
</HTML>

===========================================
mycorp.page.cs
===========================================
namespace MyCorp
{
public partial class Page : System.Web.UI.Page
{
private String _test = String.Empty;

public String Test {
get { return _test; }
set { _test = value; }
}
}
}





 
Reply With Quote
 
 
 
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      02-08-2008
You've put a variable into what's known as a Page directive. You don't put
code in there. The place you've put the Test="abc" is only for passing
information to the Page regarding how to set it up.

You need to really look at some of the quickstart examples over at
www.asp.net to get a feel for how to do this. Since ASP.Net is event
driven, you need to write code that responds to those events. If you're
wanting to set the Test variable to some value, you need to do it at the
right point. You also wouldn't do it in the designer surface (the .aspx
page), you would do it in your .cs page. I'm guessing you're probably coming
from a classic ASP or PHP background as this would be one of the first
things someone who is used to those platforms would do. Visit the
quickstarts and get a feel as to how the event driven nature of ASP.Net
works as it will save you a lot of frustration.


--
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Bob" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I am getting this error when trying to use a custom property in my page
>directive:
>
> Error parsing attribute 'test': Type 'System.Web.UI.Page' does not have a
> public property named 'test'.
>
> What am I doing wrong?
>
> Thanks
>
> ===========================================
> default.aspx
> ===========================================
> <%@ Page Language="C#" CodeFile="mycorp.page.cs" Inherits="MyCorp.Page"
> Test="abc" %>
> <HTML>
> </HTML>
>
> ===========================================
> mycorp.page.cs
> ===========================================
> namespace MyCorp
> {
> public partial class Page : System.Web.UI.Page
> {
> private String _test = String.Empty;
>
> public String Test {
> get { return _test; }
> set { _test = value; }
> }
> }
> }
>
>
>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSE 4 11-15-2006 02:40 AM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola Microsoft Certification 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSD 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd realexxams@yahoo.com Microsoft Certification 0 05-10-2006 02:35 PM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM



Advertisments