I would like to create Web site where Polish and English pages use the same class but error occured with 'using system' (CS1519: Invalid token 'using' in class, struct, or interface member declaratio

I would like to create Web site where Polish and English pages use the same class. Polish ones use inherits 'pl' and English ones inherits 'en'. I have created these pages but a error occured with 'using system' (CS1519: Invalid token 'using' in class, struct, or interface member declaration). What is wrong?

Polish page (/pl/index.aspx):

//Definig inherits from the class

<%

@ Page Language ="C#" codefile="~/App_Data/elements.cs" inherits="pl" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml">

<

head>

//Using class

<script runat="server" src="../App_Data/elements.cs">

 //Definig class string active

public void Page_Load (object scr, EventArgs e)

{

string active = "index";

}

</script>

<meta content="text/html; charset=iso-8859-2" http-equiv="Content-Type" />

<title>Kamil Szmit (szmitek) - strona g³ówna</title>

<link href="../format.css" rel="stylesheet" type="text/css" />

<meta content="Kamil, Szmit; szmitek" name="keywords" />

<meta content="Witryna osobista Kamila Szmita" name="description" />

//Inserting "head" value

<%

=HttpUtility.HtmlEncode (head)%>

</

head>

<

body>

//Inserting "body" value

<%

=HttpUtility.HtmlEncode (body)%>

<div class="content">

<p>

Witam na mojej nowej witrynie.</p>

</div>

</body>

</html>

Similar English page (en/index.aspx):

//Using inherits "en"

<%@ Page Language ="C#" CodeFile="~/App_Data/elements.cs" inherits="en" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml">

<

head>

<

script runat="server" src="../App_Data/elements.cs">

public void Page_Load (object scr, EventArgs e)

{

string active = "index";

}

</script>

<meta content="text/html; charset=iso-8859-2" http-equiv="Content-Type" />

<title>Kamil Szmit (szmitek) - home page</title>

<link href="../../format.css" rel="stylesheet" type="text/css" />

<meta content="Kamil, Szmit; szmitek" name="keywords" />

<meta content="Kamil Szmit's Personal Web Site" name="description" />

<% =HttpUtility.HtmlEncode (head)%>

</

head>

<

body>

<% =HttpUtility.HtmlEncode (body)%>

<div class="content">

<p>

Welcome to my Web site.</p>

</div>

</body>

</html>

Class (App_Data/elements.cs):

//Using system to System.Web UI.Page

using

System;

//Partial class for Polish pages, for English similar

public

partial class pl : System.Web.UI.Page

{

 //Definig "strings"

public string active;

public string head;

public string body;

public void Page_Load(object src, EventArgs e)

{

string head = "<link rel='alternate' type='application/rss+xml' title='Kamil Szmit - nowinki' href='../rss.aspx' /><meta name='resource-type' content='document' /><meta name='distribution' content='global' />";

string body = "<div class='header'><h1>Kamil Szmit</h1><h1>szmitek</h1></div><table class='menu' cellspacing='0' cellpadding='0'><tr><td><div class='menu'><p><a href='rss.aspx' title='RSS - rzeczywi¶cie prosta syndykacja' class='additional'>¬ród³o RSS</a><a href='../en/" + active + ".aspx' title='Change language into English' class='additional'>English</a></p></div></td></tr></table>";

}

}

public

partial class en : System.Web.UI.Page

{

public string active;

public string head;

public string body;

public void Page_Load(object src, EventArgs e)

{

string head = "<link rel='alternate' type='application/rss+xml' title='Kamil Szmit - news' href='../rss.aspx' /><meta name='resource-type' content='document' /><meta name='distribution' content='global' />";

string body = "<div class='header'><h1>Kamil Szmit</h1><h1>szmitek</h1></div><table class='menu' cellspacing='0' cellpadding='0'><tr><td><div class='menu'><p><a href='rss.aspx' title='RSS - Really Simple Sindication' class='additional'>RSS Source</a><a href='../en/" + active + ".aspx' title='Zmień język na polski - Change language into Polish' class='additional'>Polski</a></p></div></td></tr></table>";

 

}

}

Could you tell me  how to resolve this problem? I want script to insert my vaslues from class.


Kamil Szmit (szmitek)
0
szmitek
4/15/2007 2:35:18 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

2 Replies
1631 Views

Similar Articles

[PageSpeed] 48
Get it on Google Play
Get it on Apple App Store

What version of ASP.NET are you using? If ASP.NET 2.0, the job is much easier as one page can handle any number of translations.

Look at http://www.guysmithferrier.com/ and in particular at Guy Smith's book ISBN 0321341384 pages 123 to 161. The book is available online at Safari books at http://safari.oreilly.com/0321341384

Also his presentation http://www.guysmithferrier.com/downloads/teni18n.pdf

There is a free "Howto" on internationalisation at http://www.asp.net/learn/videos/view.aspx?tabid=63&id=40

 

 


Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
0
TATWORTH
4/15/2007 6:55:21 AM

I have removed "using system" and added "System" before EventArgs.

Class:

public

partial class pl : System.Web.UI.Page

{

public string active;

public string head;

public string body;

public void Page_Load(object src, System.EventArgs e)

{

string head = "<link rel='alternate' ... content='global' />";

string body = "...";

}

}

public

partial class en : System.Web.UI.Page

{

public string active;

public string head;

public string body;

public void Page_Load(object src, System.EventArgs e)

{

string head = "...";

string body = "<div class='header'...</table>";

 

}

}

 Class does not cause a error but values are not being included in script.


Kamil Szmit (szmitek)
0
szmitek
4/15/2007 11:36:18 AM
Reply:

Similar Artilces:

Can any one help due to this problem Error 1 'System.Web.UI.Page.Application' is a 'property' but is used like a 'method'
Hi all ! while creating application,session variables i am getting this problem can u suggest any one. Error 1 'System.Web.UI.Page.Application' is a 'property' but is used like a 'method'  lokesh   As a general guideline for seeking help, always show the code that is not working for you.  Your description alone is not enough for us to be able to help you. Alister kplokesh: Hi all ! while creating application,session variables i am getting this problem can u suggest any one. Error 1 'System.Web.UI.Page.Application' is a 'property' but is us...

Re: [perl #35982] use of backslashed '-' following '$' within character class causes 'Use of uninitialized value in concatenation (.) or string' error under 'use warnings' pragma
--- yves orton via RT <perlbug-followup@perl.org> wrote: > On 5/26/05, demerphq <demerphq@gmail.com> wrote: > > On 26 May 2005 08:13:03 -0000, via RT fdhsbgeryft > lkjhuibfmfsi > > <perlbug-followup@perl.org> wrote: > ... > > > I hope I have been specific enough for you to > identify > > > this bug with relative ease, I have never > submitted a > > > bug before and I'm not exactly a professional > > > programmer > > Try www.perlmonks.org next time you suspect you've > found a bug...

Compiler Error Message: CS0118: 'System.Web.Caching.Cache' is a 'type' but is used like a 'variable'
What am I missing??????????using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using com.amazon.webservices; using System.Web.Caching; /// <summary> /// Summary description for AmazonWS /// </summary> public class AmazonWS { public AmazonWS() { } public static DataSet AmazonToDataSet(string powersearchstring) { DataSet ds; //is it in the cache? if (Cache[powersearchstring] == null) { //create our query ItemSearchResponse response ...

'System.Web.UI.IDataItemContainer.DataItem' is a 'property' but is used like a 'method'
On the line "<%# Container.DataItem("BlogID") %>", I get the error listed in the title of this post. I'm not sure why, I use this same for on other pages to get data from a database and I don't get this error.         <asp:GridView ID="GridView1"         runat="server"         AutoGenerateColumns="False"         DataKeyNames="BlogID"        D...

System.Web.UI.Page.Cache is a 'property' but is used like a 'method'
if (Cache("MyData") == null){ds = myclasslibrary.lookupIDs();  <<filling datasetif (ds != null){if (ds.Tables[0].Rows.Count > 0){ddl.DataTextField = "Text";ddl.DataValueField = "ID";ddl.DataSource = ds;ddl.DataBind();Cache.Insert("MyData", ds, null,DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration);} }else{ds = ((DataSet) (Cache("MyData")));} error: System.Web.UI.Page.Cache is a 'property' but is used like a 'method'Its all about coding! Change the 2 lines that say Cache("MyData") to be Cache["MyData"] instead.If this post answered your question please remember to ...

'System.Web.HttpContext.Session' is a 'property' but is used like a 'method
Hello, I'm trying to set my sessions into a class so I can set and access it easily. I get a 'System.Web.HttpContext.Session' is a 'property' but is used like a 'method' error, can you see what's wrong with my code ?  Thanks  public class SessionManager    {                public static bool isLogged        {            get        &nb...

'System.Web.UI.WebControls.DataListItem.DataItem' is a 'property' but is used like a 'method'
 HI I have a datalist with OnItemDataBoundI get the following error when I try to get the DataItem 'System.Web.UI.WebControls.DataListItem.DataItem' is a 'property' but is used like a 'method' , any idea what's wrong with the line ?  public void Item_Bound(object sender, DataListItemEventArgs e)    {        Label originalPriceLabel;        if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem)        {    &n...

'Class' is not a valid base class because it does not extend class 'System.Web.UI.Page'.
Hi I am getting this error. My code was in a control and I moved it to a regular page. Error: Parser Error Message: 'MyClass.LevelOnePageOne' is not a valid base class because it does not extend class 'System.Web.UI.Page'. Source Error: Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Page1.aspx.vb" Inherits="MyClass.LevelOnePageOne"%> Line 2: <HTML> Line 3: <HEAD> Source File: c:\inetpub\wwwroot\MyApp\Level1\Page1.aspx Line: 1 Here is the first few lines of the codebehind fi...

superreview requested: [Bug 378692] warning C4099: 'OnLinkClickEvent' : type name first seen using 'struct' now seen using 'class'
timeless <timeless@bemail.org> has asked Christian Biesinger (:bi) <cbiesinger@gmx.at> for superreview: Bug 378692: warning C4099: 'OnLinkClickEvent' : type name first seen using 'struct' now seen using 'class' https://bugzilla.mozilla.org/show_bug.cgi?id=378692 Attachment 262714: call it a class https://bugzilla.mozilla.org/attachment.cgi?id=262714&action=edit ...

superreview granted: [Bug 378692] warning C4099: 'OnLinkClickEvent' : type name first seen using 'struct' now seen using 'class'
Boris Zbarsky <bzbarsky@mit.edu> has granted superreview: Bug 378692: warning C4099: 'OnLinkClickEvent' : type name first seen using 'struct' now seen using 'class' https://bugzilla.mozilla.org/show_bug.cgi?id=378692 Attachment 262714: call it a class https://bugzilla.mozilla.org/attachment.cgi?id=262714&action=edit ...

superreview requested: [Bug 313035] 'nsAutoGCRoot' : type name first seen using 'struct' now seen using 'class' : [Attachment 200113] fix forward decl
timeless@myrealbox.com (working) <timeless@bemail.org> has asked Boris Zbarsky <bzbarsky@mit.edu> for superreview: Bug 313035: 'nsAutoGCRoot' : type name first seen using 'struct' now seen using 'class' https://bugzilla.mozilla.org/show_bug.cgi?id=313035 Attachment 200113: fix forward decl https://bugzilla.mozilla.org/attachment.cgi?id=200113&action=edit ...

superreview granted: [Bug 313035] 'nsAutoGCRoot' : type name first seen using 'struct' now seen using 'class' : [Attachment 200113] fix forward decl
Boris Zbarsky <bzbarsky@mit.edu> has granted timeless@myrealbox.com (working) <timeless@bemail.org>'s request for superreview: Bug 313035: 'nsAutoGCRoot' : type name first seen using 'struct' now seen using 'class' https://bugzilla.mozilla.org/show_bug.cgi?id=313035 Attachment 200113: fix forward decl https://bugzilla.mozilla.org/attachment.cgi?id=200113&action=edit ...

superreview requested: [Bug 291436] r:\mozilla\layout\generic\nsBlockFrame.h(628) : warning C4099: 'nsBlockFrame::nsAutoOOFFrameList' : type name first seen using 'struct' now seen using 'class' : [A
timeless@myrealbox.com (working) <timeless@bemail.org> has asked Robert O'Callahan (Novell) <roc@ocallahan.org> for superreview: Bug 291436: r:\mozilla\layout\generic\nsBlockFrame.h(628) : warning C4099: 'nsBlockFrame::nsAutoOOFFrameList' : type name first seen using 'struct' now seen using 'class' https://bugzilla.mozilla.org/show_bug.cgi?id=291436 Attachment 181531: match decl https://bugzilla.mozilla.org/attachment.cgi?id=181531&action=edit ...

Use 'Credentials' in 'Authentication' in file 'Web.Config'
Why 'LoginUrl' is not recoganized by ASP.NET when I use in authentication mode 'Form'? Before VS.NET in which .NET1.0 is predefined was installed,I had installed .NET1.1 seperatedly. However,the error message indicates configuration error is just from .NET1.0. Therefore,is that 'LoginUrl' only accepted in .NET1.1? 'loginUrl' should work in both versions. Please note the authentication mode should be "Forms", not "Form". What is the error message you are getting? Thanks, Laura.This posting is provided "AS IS" with no warranties, and confers no rights. Yes,I...

Web resources about - I would like to create Web site where Polish and English pages use the same class but error occured with 'using system' (CS1519: Invalid token 'using' in class, struct, or interface member declaratio - asp.net.web-forms

Resources last updated: 11/24/2015 12:38:41 AM