473,396 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

spageti code in asp.net

why this is not possible in asp.net?
error:
CS0103: The name 'i' does not exist in the class or namespace...

<%
int i = 0;
%>

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False"
DataSource='<%# (DataBinder.Eval(Container.DataItem, "EtazaId"))%>'>
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0" ID="Table2">
</HeaderTemplate>
<ItemTemplate>

<%
i = i + 1;
%>
Nov 19 '05 #1
8 1015
"TomislaW" <to*********@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP15.phx.gbl...
why this is not possible in asp.net?
error:
CS0103: The name 'i' does not exist in the class or namespace...

<%
int i = 0;
%>

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False"
DataSource='<%# (DataBinder.Eval(Container.DataItem, "EtazaId"))%>'>
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0"
ID="Table2">
</HeaderTemplate>
<ItemTemplate>

<%
i = i + 1;
%>


What it said.

Which class is "i" declared in? Which class is it being referenced in?

John Saunders
Nov 19 '05 #2
IMO have a look at the source code created for this construction. It's
likely created as distinct pieces of code or something preventing the "i"
variable to be know accross distinct pieces of code.

Note also that this is probably because ASP.NET doesn't just copy any more
the "HTML" fragments to the output stream. Server side tags needs to be
processed server side in a more complex manner and the code fragments have
to fit in this scheme.

Patrice

--

"TomislaW" <to*********@hotmail.com> a écrit dans le message de
news:eJ**************@TK2MSFTNGP15.phx.gbl...
why this is not possible in asp.net?
error:
CS0103: The name 'i' does not exist in the class or namespace...

<%
int i = 0;
%>

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False"
DataSource='<%# (DataBinder.Eval(Container.DataItem, "EtazaId"))%>'>
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0" ID="Table2"> </HeaderTemplate>
<ItemTemplate>

<%
i = i + 1;
%>

Nov 19 '05 #3
you can code like this

<%
int i = 0;
%>

or you can code like this

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False" >

The page is composed of component parts, when you tell it to use a server
side component it expects to see a particular type of coding convention in
the page - whinc does not include random code.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"TomislaW" <to*********@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP15.phx.gbl...
why this is not possible in asp.net?
error:
CS0103: The name 'i' does not exist in the class or namespace...

<%
int i = 0;
%>

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False"
DataSource='<%# (DataBinder.Eval(Container.DataItem, "EtazaId"))%>'>
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0" ID="Table2"> </HeaderTemplate>
<ItemTemplate>

<%
i = i + 1;
%>

Nov 19 '05 #4
I gave this a look. The two code fragments are in distinct rendering
routines (as they are not at the same level in the controls tree).

Patrice
--

"Patrice" <no****@nowhere.com> a écrit dans le message de
news:uG**************@TK2MSFTNGP11.phx.gbl...
IMO have a look at the source code created for this construction. It's
likely created as distinct pieces of code or something preventing the "i"
variable to be know accross distinct pieces of code.

Note also that this is probably because ASP.NET doesn't just copy any more
the "HTML" fragments to the output stream. Server side tags needs to be
processed server side in a more complex manner and the code fragments have
to fit in this scheme.

Patrice

--

"TomislaW" <to*********@hotmail.com> a écrit dans le message de
news:eJ**************@TK2MSFTNGP15.phx.gbl...
why this is not possible in asp.net?
error:
CS0103: The name 'i' does not exist in the class or namespace...

<%
int i = 0;
%>

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False"
DataSource='<%# (DataBinder.Eval(Container.DataItem, "EtazaId"))%>'>
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0"

ID="Table2">
</HeaderTemplate>
<ItemTemplate>

<%
i = i + 1;
%>


Nov 19 '05 #5
it is not always everything so simple as microsoft says
i have repeater inside other repeater
i need number of rows for second repeater

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
you can code like this

<%
int i = 0;
%>

or you can code like this

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False" >

The page is composed of component parts, when you tell it to use a server
side component it expects to see a particular type of coding convention in
the page - whinc does not include random code.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"TomislaW" <to*********@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP15.phx.gbl...
why this is not possible in asp.net?
error:
CS0103: The name 'i' does not exist in the class or namespace...

<%
int i = 0;
%>

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False"
DataSource='<%# (DataBinder.Eval(Container.DataItem, "EtazaId"))%>'>
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0"

ID="Table2">
</HeaderTemplate>
<ItemTemplate>

<%
i = i + 1;
%>


Nov 19 '05 #6
Try to use the "script" tag instead of <%. With the script tag, ASP.NET
consider this as a "stand alone" piece of code and it is included outside of
any rendering procedure. This way you'll have a variable that is global to
your page alloiwng to access it from other location.

Patrice
--

"TomislaW" <to*********@hotmail.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP09.phx.gbl...
it is not always everything so simple as microsoft says
i have repeater inside other repeater
i need number of rows for second repeater

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
you can code like this

<%
int i = 0;
%>

or you can code like this

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False" >

The page is composed of component parts, when you tell it to use a server side component it expects to see a particular type of coding convention in the page - whinc does not include random code.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"TomislaW" <to*********@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP15.phx.gbl...
why this is not possible in asp.net?
error:
CS0103: The name 'i' does not exist in the class or namespace...

<%
int i = 0;
%>

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False"
DataSource='<%# (DataBinder.Eval(Container.DataItem, "EtazaId"))%>'>
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0"

ID="Table2">
</HeaderTemplate>
<ItemTemplate>

<%
i = i + 1;
%>



Nov 19 '05 #7
Try being object-oriented. ASP.Net is.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"TomislaW" <to*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
it is not always everything so simple as microsoft says
i have repeater inside other repeater
i need number of rows for second repeater

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
you can code like this

<%
int i = 0;
%>

or you can code like this

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False" >

The page is composed of component parts, when you tell it to use a server
side component it expects to see a particular type of coding convention
in
the page - whinc does not include random code.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"TomislaW" <to*********@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP15.phx.gbl...
why this is not possible in asp.net?
error:
CS0103: The name 'i' does not exist in the class or namespace...

<%
int i = 0;
%>

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False"
DataSource='<%# (DataBinder.Eval(Container.DataItem, "EtazaId"))%>'>
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0"

ID="Table2">
</HeaderTemplate>
<ItemTemplate>

<%
i = i + 1;
%>



Nov 19 '05 #8
try using
Level2RepeaterName.Items.Count

"TomislaW" wrote:
it is not always everything so simple as microsoft says
i have repeater inside other repeater
i need number of rows for second repeater

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
you can code like this

<%
int i = 0;
%>

or you can code like this

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False" >

The page is composed of component parts, when you tell it to use a server
side component it expects to see a particular type of coding convention in
the page - whinc does not include random code.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"TomislaW" <to*********@hotmail.com> wrote in message
news:eJ**************@TK2MSFTNGP15.phx.gbl...
why this is not possible in asp.net?
error:
CS0103: The name 'i' does not exist in the class or namespace...

<%
int i = 0;
%>

<asp:Repeater ID="RepeaterSoba" Runat="server" EnableViewState="False"
DataSource='<%# (DataBinder.Eval(Container.DataItem, "EtazaId"))%>'>
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0"

ID="Table2">
</HeaderTemplate>
<ItemTemplate>

<%
i = i + 1;
%>



Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
9
by: bigoxygen | last post by:
Hi. I'm using a 3 tier FrontController Design for my web application right now. The problem is that I'm finding to have to duplicate a lot of code for similar functions; for example, listing...
4
by: jason | last post by:
Hello. Newbie on SQL and suffering through this. I have two tables created as such: drop table table1; go drop table table2; go
16
by: Dario de Judicibus | last post by:
I'm getting crazy. Look at this code: #include <string.h> #include <stdio.h> #include <iostream.h> using namespace std ; char ini_code = {0xFF, 0xFE} ; char line_sep = {0x20, 0x28} ;
109
by: Andrew Thompson | last post by:
It seems most people get there JS off web sites, which is entirely logical. But it is also a great pity since most of that code is of such poor quality. I was looking through the JS FAQ for any...
5
by: ED | last post by:
I currently have vba code that ranks employees based on their average job time ordered by their region, zone, and job code. I currently have vba code that will cycle through a query and ranks each...
0
by: Namratha Shah \(Nasha\) | last post by:
Hey Guys, Today we are going to look at Code Access Security. Code access security is a feature of .NET that manages code depending on its trust level. If the CLS trusts the code enough to...
18
by: Joe Fallon | last post by:
I have some complex logic which is fairly simply to build up into a string. I needed a way to Eval this string and return a Boolean result. This code works fine to achieve that goal. My...
37
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.