I'm getting a compiler error on my ASP.NET page and I can't see the
cause. I have a simple C# class compiled into a DLL and placed in my
bin directory which has a public property QuestionText. When I try
and set the property the compiler throws up
Compiler Error Message: CS1519: Invalid token '=' in class, struct, or
interface member declaration
If I don't try and set the property it prints out the default value of
the property fine.
my code is below
<%@ Page Language="C#" %>
<%@ import Namespace="MyNa mespace" %>
<script runat="server">
PollQuestion pollQ = new PollQuestion();
pollQ.QuestionT ext = "My New Question";
</script>
<html>
<head>
</head>
<body>
<%=pollQ.Questi onText %>
</body>
</html>
The C# class is
[code:1:29c46e87 60]
using System;
namespace MyNamespace
{
public class PollQuestion
{
// private members
string strQuestionText ;
// empty constructor
public PollQuestion ()
{
}
// public accessors
public string QuestionText
{
get { return strQuestionText ;}
set { strQuestionText = value; }
}
}
}
[/code:1:29c46e87 60]
I've been trying to find the problem for a while now and so far
nobodys been able to help me.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com 3 2715
Property Type doesnot have parenthesis
Remove parenthesis from C# Class
"Twanger" <ia*@netbyte-dot-com.no-spam.invalid> wrote in message
news:40******** **@Usenet.com.. . I'm getting a compiler error on my ASP.NET page and I can't see the cause. I have a simple C# class compiled into a DLL and placed in my bin directory which has a public property QuestionText. When I try and set the property the compiler throws up
Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration
If I don't try and set the property it prints out the default value of the property fine.
my code is below
<%@ Page Language="C#" %> <%@ import Namespace="MyNa mespace" %> <script runat="server"> PollQuestion pollQ = new PollQuestion(); pollQ.QuestionT ext = "My New Question"; </script>
<html> <head> </head> <body> <%=pollQ.Questi onText %>
</body> </html> The C# class is
[code:1:29c46e87 60] using System;
namespace MyNamespace { public class PollQuestion { // private members string strQuestionText ;
// empty constructor public PollQuestion () {
}
// public accessors public string QuestionText { get { return strQuestionText ;} set { strQuestionText = value; } } } }
[/code:1:29c46e87 60]
I've been trying to find the problem for a while now and so far nobodys been able to help me.
Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.usenet.com
Ignore the previous message
Replace <%=XXX%> with <%#XXX%>
"Twanger" <ia*@netbyte-dot-com.no-spam.invalid> wrote in message
news:40******** **@Usenet.com.. . I'm getting a compiler error on my ASP.NET page and I can't see the cause. I have a simple C# class compiled into a DLL and placed in my bin directory which has a public property QuestionText. When I try and set the property the compiler throws up
Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration
If I don't try and set the property it prints out the default value of the property fine.
my code is below
<%@ Page Language="C#" %> <%@ import Namespace="MyNa mespace" %> <script runat="server"> PollQuestion pollQ = new PollQuestion(); pollQ.QuestionT ext = "My New Question"; </script>
<html> <head> </head> <body> <%=pollQ.Questi onText %>
</body> </html> The C# class is
[code:1:29c46e87 60] using System;
namespace MyNamespace { public class PollQuestion { // private members string strQuestionText ;
// empty constructor public PollQuestion () {
}
// public accessors public string QuestionText { get { return strQuestionText ;} set { strQuestionText = value; } } } }
[/code:1:29c46e87 60]
I've been trying to find the problem for a while now and so far nobodys been able to help me.
Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.usenet.com
Twanger wrote: I'm getting a compiler error on my ASP.NET page and I can't see the cause. I have a simple C# class compiled into a DLL and placed in my bin directory which has a public property QuestionText. When I try and set the property the compiler throws up
Compiler Error Message: CS1519: Invalid token '=' in class, struct, or interface member declaration
If I don't try and set the property it prints out the default value of the property fine.
my code is below
<%@ Page Language="C#" %> <%@ import Namespace="MyNa mespace" %> <script runat="server"> PollQuestion pollQ = new PollQuestion(); pollQ.QuestionT ext = "My New Question"; </script>
<html> <head> </head> <body> <%=pollQ.Questi onText %>
</body> </html>
If you click the "Show Complete Compilation Source:" link on the error
page, you can see the C# source that the .aspx page is being parsed into
- this often helps with these kinds of problems.
In your case, the problem is that your script block gets parsed into the
..aspx page's class in the declarations block. So the first line (being
a declaration) is fine, but the next line is not.
Change you script block to something like:
<script runat="server">
PollQuestion pollQ = new PollQuestion();
public void Page_Load() {
pollQ.QuestionT ext = "My New Question";
}
</script>
so that the second line is inside the Page_Load() method.
--
mikeb This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: evan.cooch |
last post by:
Greetings.
Suppose I have some function called "CheckIt" - some function to
validate form data before submitting it to e CGI script. Pretend the
name of the form is "TheForm".
If I use the following code, everything work perfctly:
<Input type=button VALUE="Submit your form"
onClick="javascript:return CheckIt(TheForm)">
|
by: s.caron |
last post by:
Hi,
I'm trying to open an aspx page but I have this error
Compiler Error Message: CS1519: Invalid token '=' in class, struct, or
interface member declaration
in the line : usuario.Credentials =
System.Net.CredentialCache.DefaultCredentials;
If I put this code in a method like Page_load
|
by: Ben Holness |
last post by:
Hi all,
I have a system which allows users to enter a message on a (PHP) website.
This message is then put into a (MySQL) Database.
A perl script then picks up the message and creates an XML document.
The webpages, database and XML are all UTF-8, however every now and then I
get an error in the XML parser that tells me I have an invalid token. This
occurs when the message contains particular characters, although I don't
|
by: Manuel |
last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using
devc++.
So I've imported the glut32.dsp into devc++, included manually some
headers, and start to compile.
It return a very strange error. In your experience, where I should
looking to find the real error? Surely the sintax of glut is correct...
gcc.exe -c glut_bitmap.c -o glut_bitmap.o -I"C:/Dev-Cpp/include"
-I"../../include" -D__GNUWIN32__ -W -DWIN32 -DNDEBUG...
|
by: Sebouh |
last post by:
I'm very close of shooting myself in the head right now. Why in hell does free(xx) give me an error: *** glibc detected *** free(): invalid pointer: 0x08ce6158 ***
// The function returns something like the argv parameter in main.
char** parser (char* ch)
{
char** xx = NULL;
char* temp; // contains the input which will be modified when using strtok
int length = strlen (ch); // length of the string
char* token;
| |
by: miamikk |
last post by:
I have created XML files using BCP in SQL with FOR XML AUTO, ELEMENTS option.
When I try to databind for XML file to a GridView in ASP.NET, I get an error " 'd/Commodity Description' has an invalid token".
All I did was drag a GridView and selected the datasource as XML file. The XPath expression was selected automatically as "d/Commodity Description".
I am not sure if this is an XML question or ASP.NET. I would appreciate if any XML...
|
by: brad |
last post by:
This works:
This does not (one the end, 09 is used instead of 9)
File "<stdin>", line 1
area_group = {001:06, 002:04, 003:04, 006:09}
SyntaxError: invalid token
Why does 09 cause an invalid token while 9 does not?
|
by: Rod |
last post by:
This is my first WCF service and it is running on my development machine (XP
Pro SP2) under IIS, I am using wsHttpBinding. (I will eventually put it onto
a Windows 2003 Server running under IIS on the server as an Intranet
application). The strange is I've stepped through the code in the WCF
service, it makes the call to the SQL Server database, it retrieves the data
and puts it into the DataTable object, and then I close the connection and...
|
by: =?Utf-8?B?UmF2aQ==?= |
last post by:
Hi, I have WCF service and integrated with STS (WS-Federation). The Service
exposes 5 endpoints Win, UNT and Federated Windows, Federated UNT and Mex
endpoint.
My STS Service exposes 3 endpoints WIN, UNT and Mex.
I am getting error when I sent a request from a client to WCF Service
Fed-Win/ Fed-Unt endpoints. But it is passing for the regular Win and Unt
endpoints.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |