By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

How can I do this?

P: n/a
m.a

Hello,

I know that I can do this:

<asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
></asp:Label>


but how can I do this:

<asp:Label runat="server" ID="test" text='<%# GetAString()%>' ></asp:Label>

where GetAString() is a C# function returning a string (sample as follow):

public static string GetSString()

{

return "test";

}

when I add the above line to my aspx page, I am not getting any error, but
nothing for label is shown when it should show test.

Any suggestion on what is the problem?

Regards


Sep 15 '08 #1
Share this Question
Share on Google+
16 Replies


P: n/a
m.a explained on 15-9-2008 :
Hello,

I know that I can do this:

<asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
></asp:Label>

but how can I do this:

<asp:Label runat="server" ID="test" text='<%# GetAString()%>' ></asp:Label>

where GetAString() is a C# function returning a string (sample as follow):

public static string GetSString()

{

return "test";

}

when I add the above line to my aspx page, I am not getting any error, but
nothing for label is shown when it should show test.

Any suggestion on what is the problem?

Regards
<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

use "%=" instead of "%#"

Hans Kesting
Sep 15 '08 #2

P: n/a
m.a

"Hans Kesting" <ne*********@spamgourmet.comwrote in message
news:uR**************@TK2MSFTNGP05.phx.gbl...
m.a explained on 15-9-2008 :
>Hello,

I know that I can do this:

<asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
> ></asp:Label>

but how can I do this:

<asp:Label runat="server" ID="test" text='<%# GetAString()%>'
> ></asp:Label>

where GetAString() is a C# function returning a string (sample as
follow):

public static string GetSString()

{

return "test";

}

when I add the above line to my aspx page, I am not getting any error,
but nothing for label is shown when it should show test.

Any suggestion on what is the problem?

Regards

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

use "%=" instead of "%#"

Hans Kesting

Thanks, but it doesn't work.

I created a new project in MSVS2008 and the default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="WebApplication1._Default" %>

<!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 runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

</div>

</form>

</body>

</html>

And the default.aspx.cs is as follow:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace WebApplication1

{

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected string GetAString()

{

return "test";

}

}

but when I run the application, the result is a blank page.

any suggestion?

Regards


Sep 15 '08 #3

P: n/a
for a data binding expression to be evaluated, you still need to call
DataBind().

-- bruce (sqlwork.com)
"m.a" wrote:
>
Hello,

I know that I can do this:

<asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
></asp:Label>

but how can I do this:

<asp:Label runat="server" ID="test" text='<%# GetAString()%>' ></asp:Label>

where GetAString() is a C# function returning a string (sample as follow):

public static string GetSString()

{

return "test";

}

when I add the above line to my aspx page, I am not getting any error, but
nothing for label is shown when it should show test.

Any suggestion on what is the problem?

Regards


Sep 15 '08 #4

P: n/a
m.a
Thanks,
But it is not a databinding expression. I also add the databind() to the
form_load but no difference, (with the refrence to the codes that I send
with my second post.

Regards

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:BB**********************************@microsof t.com...
for a data binding expression to be evaluated, you still need to call
DataBind().

-- bruce (sqlwork.com)
"m.a" wrote:
>>
Hello,

I know that I can do this:

<asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
> ></asp:Label>

but how can I do this:

<asp:Label runat="server" ID="test" text='<%# GetAString()%>'
> ></asp:Label>

where GetAString() is a C# function returning a string (sample as
follow):

public static string GetSString()

{

return "test";

}

when I add the above line to my aspx page, I am not getting any error,
but
nothing for label is shown when it should show test.

Any suggestion on what is the problem?

Regards



Sep 15 '08 #5

P: n/a
"m.a" <ma.@spamoff.comwrote in message
news:u2*************@TK2MSFTNGP05.phx.gbl...
>><asp:Label runat="server" ID="test" text='<%# GetAString()%>'
></asp:Label>

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

use "%=" instead of "%#"

Thanks, but it doesn't work.

I created a new project in MSVS2008 and the default.aspx is :

protected string GetAString()
Are you sure that your code-behind function is being called? Put a
breakpoint in it to check...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 15 '08 #6

P: n/a
m.a

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:e5**************@TK2MSFTNGP05.phx.gbl...
"m.a" <ma.@spamoff.comwrote in message
news:u2*************@TK2MSFTNGP05.phx.gbl...
>>><asp:Label runat="server" ID="test" text='<%# GetAString()%>'
></asp:Label>
<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

use "%=" instead of "%#"

Thanks, but it doesn't work.

I created a new project in MSVS2008 and the default.aspx is :

protected string GetAString()

Are you sure that your code-behind function is being called? Put a
breakpoint in it to check...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
No it is not called? But I don't know why? What is wrong in my code?


Sep 15 '08 #7

P: n/a
protected string GetAString()
{
return "test";
}
Try this instead:

protected void GetAString()
{
Response.Write("test");
}

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"m.a" <ma.@spamoff.comwrote in message
news:u2*************@TK2MSFTNGP05.phx.gbl...
>
"Hans Kesting" <ne*********@spamgourmet.comwrote in message
news:uR**************@TK2MSFTNGP05.phx.gbl...
>m.a explained on 15-9-2008 :
>>Hello,

I know that I can do this:

<asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
></asp:Label>

but how can I do this:

<asp:Label runat="server" ID="test" text='<%# GetAString()%>'
></asp:Label>

where GetAString() is a C# function returning a string (sample as
follow):

public static string GetSString()

{

return "test";

}

when I add the above line to my aspx page, I am not getting any error,
but nothing for label is shown when it should show test.

Any suggestion on what is the problem?

Regards

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

use "%=" instead of "%#"

Hans Kesting


Thanks, but it doesn't work.

I created a new project in MSVS2008 and the default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="WebApplication1._Default" %>

<!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 runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

</div>

</form>

</body>

</html>

And the default.aspx.cs is as follow:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace WebApplication1

{

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}
}

but when I run the application, the result is a blank page.

any suggestion?

Regards

Sep 15 '08 #8

P: n/a
m.a
It is not working since the function never called.

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:Or*************@TK2MSFTNGP05.phx.gbl...
>protected string GetAString()
{
return "test";
}

Try this instead:

protected void GetAString()
{
Response.Write("test");
}

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"m.a" <ma.@spamoff.comwrote in message
news:u2*************@TK2MSFTNGP05.phx.gbl...
>>
"Hans Kesting" <ne*********@spamgourmet.comwrote in message
news:uR**************@TK2MSFTNGP05.phx.gbl...
>>m.a explained on 15-9-2008 :
Hello,

I know that I can do this:

<asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
></asp:Label>

but how can I do this:

<asp:Label runat="server" ID="test" text='<%# GetAString()%>'
></asp:Label>

where GetAString() is a C# function returning a string (sample as
follow):

public static string GetSString()

{

return "test";

}

when I add the above line to my aspx page, I am not getting any error,
but nothing for label is shown when it should show test.

Any suggestion on what is the problem?

Regards

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

use "%=" instead of "%#"

Hans Kesting


Thanks, but it doesn't work.

I created a new project in MSVS2008 and the default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<!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 runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

</div>

</form>

</body>

</html>

And the default.aspx.cs is as follow:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace WebApplication1

{

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}
}

but when I run the application, the result is a blank page.

any suggestion?

Regards


Sep 15 '08 #9

P: n/a
but it is a databinding expression, even it if does not access the databound
object. call DataBind() on the label, when you wnat the evaluation to take
effect.

Databinding expressions are pretty simple, when the page is compiled, if a
control has a databinding expression (property = "<%# expr() %>") then the
equalivent to following code is generated (actually ondatabinding fires an
event to call a delegate, instead of calling the code direct) :

OnDataBinding(EvaneArg e)
{
property = expr();
}

-- bruce (sqlwork.com)
"m.a" wrote:
Thanks,
But it is not a databinding expression. I also add the databind() to the
form_load but no difference, (with the refrence to the codes that I send
with my second post.

Regards

"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:BB**********************************@microsof t.com...
for a data binding expression to be evaluated, you still need to call
DataBind().

-- bruce (sqlwork.com)
"m.a" wrote:
>
Hello,

I know that I can do this:

<asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
></asp:Label>

but how can I do this:

<asp:Label runat="server" ID="test" text='<%# GetAString()%>'
></asp:Label>

where GetAString() is a C# function returning a string (sample as
follow):

public static string GetSString()

{

return "test";

}

when I add the above line to my aspx page, I am not getting any error,
but
nothing for label is shown when it should show test.

Any suggestion on what is the problem?

Regards




Sep 15 '08 #10

P: n/a
I have code like this. But I didn't use a label control. I just did
something like this:

<% GetAString(); %>

It works for me.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"m.a" <ma.@spamoff.comwrote in message
news:uu**************@TK2MSFTNGP04.phx.gbl...
It is not working since the function never called.

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:Or*************@TK2MSFTNGP05.phx.gbl...
>>protected string GetAString()
{
return "test";
}

Try this instead:

protected void GetAString()
{
Response.Write("test");
}

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"m.a" <ma.@spamoff.comwrote in message
news:u2*************@TK2MSFTNGP05.phx.gbl...
>>>
"Hans Kesting" <ne*********@spamgourmet.comwrote in message
news:uR**************@TK2MSFTNGP05.phx.gbl...
m.a explained on 15-9-2008 :
Hello,
>
I know that I can do this:
>
<asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
></asp:Label>
>
>
>
but how can I do this:
>
<asp:Label runat="server" ID="test" text='<%# GetAString()%>'
></asp:Label>
>
>
>
where GetAString() is a C# function returning a string (sample as
follow):
>
>
>
public static string GetSString()
>
{
>
return "test";
>
}
>
when I add the above line to my aspx page, I am not getting any error,
but nothing for label is shown when it should show test.
>
>
>
Any suggestion on what is the problem?
>
Regards

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

use "%=" instead of "%#"

Hans Kesting

Thanks, but it doesn't work.

I created a new project in MSVS2008 and the default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<!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 runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

</div>

</form>

</body>

</html>

And the default.aspx.cs is as follow:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace WebApplication1

{

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}
}

but when I run the application, the result is a blank page.

any suggestion?

Regards


Sep 15 '08 #11

P: n/a
m.a
Thanks, it is working but what if I want to use it with an asp control? for
example, if I want to hide/show a control based on some calculation?

for example I may want to do:

<asp:Label runat="server" ID="test" Text='test' visible=<%# ShouldShow()%>'
/>

Regards

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:Ok**************@TK2MSFTNGP05.phx.gbl...
>I have code like this. But I didn't use a label control. I just did
something like this:

<% GetAString(); %>

It works for me.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"m.a" <ma.@spamoff.comwrote in message
news:uu**************@TK2MSFTNGP04.phx.gbl...
>It is not working since the function never called.

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:Or*************@TK2MSFTNGP05.phx.gbl...
>>>protected string GetAString()
{
return "test";
}

Try this instead:

protected void GetAString()
{
Response.Write("test");
}

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"m.a" <ma.@spamoff.comwrote in message
news:u2*************@TK2MSFTNGP05.phx.gbl...

"Hans Kesting" <ne*********@spamgourmet.comwrote in message
news:uR**************@TK2MSFTNGP05.phx.gbl...
m.a explained on 15-9-2008 :
>Hello,
>>
> I know that I can do this:
>>
><asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
> ></asp:Label>
>>
>>
>>
>but how can I do this:
>>
><asp:Label runat="server" ID="test" text='<%# GetAString()%>'
> ></asp:Label>
>>
>>
>>
>where GetAString() is a C# function returning a string (sample as
>follow):
>>
>>
>>
>public static string GetSString()
>>
>{
>>
> return "test";
>>
>}
>>
>when I add the above line to my aspx page, I am not getting any
>error, but nothing for label is shown when it should show test.
>>
>>
>>
>Any suggestion on what is the problem?
>>
>Regards
>
<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />
>
use "%=" instead of "%#"
>
Hans Kesting
>
>

Thanks, but it doesn't work.

I created a new project in MSVS2008 and the default.aspx is :

<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<!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 runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />

</div>

</form>

</body>

</html>

And the default.aspx.cs is as follow:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace WebApplication1

{

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}
}

but when I run the application, the result is a blank page.

any suggestion?

Regards




Sep 15 '08 #12

P: n/a
"m.a" <ma.@spamoff.comwrote in message
news:e9**************@TK2MSFTNGP02.phx.gbl...
>>protected string GetAString()

Are you sure that your code-behind function is being called? Put a
breakpoint in it to check...

No it is not called?
Well, there's the problem!
But I don't know why? What is wrong in my code?
Difficult to tell immediately...

If you do this:

<asp:Label runat="server" ID="test" text='<%= zzzzGetAString()%>' />

do you get a runtime error...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 15 '08 #13

P: n/a
Not sure. For me, I'd simply write a little code in the Load event and set
the visibility there.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"m.a" <ma.@spamoff.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Thanks, it is working but what if I want to use it with an asp control?
for example, if I want to hide/show a control based on some calculation?

for example I may want to do:

<asp:Label runat="server" ID="test" Text='test' visible=<%#
ShouldShow()%>' />

Regards

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:Ok**************@TK2MSFTNGP05.phx.gbl...
>>I have code like this. But I didn't use a label control. I just did
something like this:

<% GetAString(); %>

It works for me.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"m.a" <ma.@spamoff.comwrote in message
news:uu**************@TK2MSFTNGP04.phx.gbl...
>>It is not working since the function never called.

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:Or*************@TK2MSFTNGP05.phx.gbl...
protected string GetAString()
{
return "test";
}

Try this instead:

protected void GetAString()
{
Response.Write("test");
}

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"m.a" <ma.@spamoff.comwrote in message
news:u2*************@TK2MSFTNGP05.phx.gbl...
>
"Hans Kesting" <ne*********@spamgourmet.comwrote in message
news:uR**************@TK2MSFTNGP05.phx.gbl.. .
>m.a explained on 15-9-2008 :
>>Hello,
>>>
>> I know that I can do this:
>>>
>><asp:Label runat="server" ID="test" text='<%# Eval("a_field")%>'
>> ></asp:Label>
>>>
>>>
>>>
>>but how can I do this:
>>>
>><asp:Label runat="server" ID="test" text='<%# GetAString()%>'
>> ></asp:Label>
>>>
>>>
>>>
>>where GetAString() is a C# function returning a string (sample as
>>follow):
>>>
>>>
>>>
>>public static string GetSString()
>>>
>>{
>>>
>> return "test";
>>>
>>}
>>>
>>when I add the above line to my aspx page, I am not getting any
>>error, but nothing for label is shown when it should show test.
>>>
>>>
>>>
>>Any suggestion on what is the problem?
>>>
>>Regards
>>
><asp:Label runat="server" ID="test" text='<%= GetAString()%>' />
>>
>use "%=" instead of "%#"
>>
>Hans Kesting
>>
>>
>
Thanks, but it doesn't work.
>
I created a new project in MSVS2008 and the default.aspx is :
>
>
>
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
>
<!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 runat="server">
>
<title></title>
>
</head>
>
<body>
>
<form id="form1" runat="server">
>
<div>
>
<asp:Label runat="server" ID="test" text='<%= GetAString()%>' />
>
</div>
>
</form>
>
</body>
>
</html>
>
>
>
And the default.aspx.cs is as follow:
>
>
>
using System;
>
using System.Collections.Generic;
>
using System.Linq;
>
using System.Web;
>
using System.Web.UI;
>
using System.Web.UI.WebControls;
>
namespace WebApplication1
>
{
>
public partial class _Default : System.Web.UI.Page
>
{
>
protected void Page_Load(object sender, EventArgs e)
>
{
>
}
>
>
}
>
but when I run the application, the result is a blank page.
>
any suggestion?
>
Regards
>
>
>
>

Sep 15 '08 #14

P: n/a
"m.a" <ma.@spamoff.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Thanks, it is working but what if I want to use it with an asp control?
for example, if I want to hide/show a control based on some calculation?

for example I may want to do:

<asp:Label runat="server" ID="test" Text='test' visible=<%#
ShouldShow()%>' />
ShouldShow will need to return 'true' or 'false' as a string...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 15 '08 #15

P: n/a
m.a
No I am not getting any error.
Whatr is the difference between
<%= %and <%# %?

where can I read more about this?

Regards

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
"m.a" <ma.@spamoff.comwrote in message
news:e9**************@TK2MSFTNGP02.phx.gbl...
>>>protected string GetAString()

Are you sure that your code-behind function is being called? Put a
breakpoint in it to check...

No it is not called?

Well, there's the problem!
>But I don't know why? What is wrong in my code?

Difficult to tell immediately...

If you do this:

<asp:Label runat="server" ID="test" text='<%= zzzzGetAString()%>' />

do you get a runtime error...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 15 '08 #16

P: n/a
"m.a" <ma.@spamoff.comwrote in message
news:eO*************@TK2MSFTNGP05.phx.gbl...

[top-posting corrected]
>>But I don't know why? What is wrong in my code?

Difficult to tell immediately...

If you do this:

<asp:Label runat="server" ID="test" text='<%= zzzzGetAString()%>' />

do you get a runtime error...?

No I am not getting any error.
In which case, you have a much more fundamental problem. The above should
have forced ASP.NET to try to run a code-behind function called
zzzzGetAString() which, I'm assuming, doesn't actually exist. This should
definitely have generated a runtime error.

I'd suggest maybe creating the page from scratch...
Whatr is the difference between
<%= %and <%# %?
The first is shorthand for "Response.Write whatever follows the equals
sign".
The second is databinding syntax, as Bruce has explained.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 15 '08 #17

This discussion thread is closed

Replies have been disabled for this discussion.