Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How2 Use Expression Syntax in HTML

Reply
Thread Tools

How2 Use Expression Syntax in HTML

 
 
clintonG
Guest
Posts: n/a
 
      08-25-2005
I'm not getting the hang of what I thought I already understood. Maybe
burnout?
I want to build a string in code and write it into the HTML for display...

// initiliazed in code
string someText = "someText";

// does not exist in the current context
<%= someText %>

// ; expected
<% someText %>

// does not exist in the current context
<% someText.ToString( ); %>

What am I doing incorrectly this time

<%= Clinton Gallagher



 
Reply With Quote
 
 
 
 
darrel
Guest
Posts: n/a
 
      08-25-2005
> I want to build a string in code and write it into the HTML for display...

You can add a item to your ASPX page (label/literal/etc.) and then set the
text of that item via your codebehind page:

yourLabel.text = someText

Otherwise, if you want to do what you were doing, you need to dim the string
as public:

Public Shared someText = "someText" in your codebehind.

-Darrel



 
Reply With Quote
 
 
 
 
clintonG
Guest
Posts: n/a
 
      08-25-2005
Thanks Darrel. I would be using controls but I'm actually trying to
determine if I can use expression syntax write out the complete HTML
declaration for an image control.

<%= Clinton Gallagher



"darrel" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>> I want to build a string in code and write it into the HTML for
>> display...

>
> You can add a item to your ASPX page (label/literal/etc.) and then set the
> text of that item via your codebehind page:
>
> yourLabel.text = someText
>
> Otherwise, if you want to do what you were doing, you need to dim the
> string
> as public:
>
> Public Shared someText = "someText" in your codebehind.
>
> -Darrel
>
>
>



 
Reply With Quote
 
Bruce Barker
Guest
Posts: n/a
 
      08-26-2005
the aspx page inherits from the codebehind, so you must make the string
protected or public.

protected string sometext = "hello";

-- bruce (sqlwork.com)




"clintonG" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm not getting the hang of what I thought I already understood. Maybe
> burnout?
> I want to build a string in code and write it into the HTML for display...
>
> // initiliazed in code
> string someText = "someText";
>
> // does not exist in the current context
> <%= someText %>
>
> // ; expected
> <% someText %>
>
> // does not exist in the current context
> <% someText.ToString( ); %>
>
> What am I doing incorrectly this time
>
> <%= Clinton Gallagher
>
>
>



 
Reply With Quote
 
clintonG
Guest
Posts: n/a
 
      08-26-2005
I had problems doing so within the Page_Load event but none when
initializing within the partial class itself.
I have little experience using code block expressions with the DNF so you
might find it interesting to discuss what I am trying to learn to do.

I've been using Page_PreInit to get the value of a cookie that contains the
name of the Theme selected from a DropDownList. I need to use that value
from the cookie to dynamically build the entire declaration for an Image
control before the Page class is compiled. I document the whole nine yards
at the beta forums [1] and welcome all comments.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[]1 http://forums.asp.net/1032623/ShowPost.aspx







"Bruce Barker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> the aspx page inherits from the codebehind, so you must make the string
> protected or public.
>
> protected string sometext = "hello";
>
> -- bruce (sqlwork.com)
>
>
>
>
> "clintonG" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I'm not getting the hang of what I thought I already understood. Maybe
>> burnout?
>> I want to build a string in code and write it into the HTML for
>> display...
>>
>> // initiliazed in code
>> string someText = "someText";
>>
>> // does not exist in the current context
>> <%= someText %>
>>
>> // ; expected
>> <% someText %>
>>
>> // does not exist in the current context
>> <% someText.ToString( ); %>
>>
>> What am I doing incorrectly this time
>>
>> <%= Clinton Gallagher
>>
>>
>>

>
>



 
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
Re: HOW2 REMOVE GEOTAGS ? PeterN Digital Photography 1 11-03-2011 06:46 PM
How2 ignore warnings in ASP.NET 2005? Cvt from 2003 tesis ASP .Net 2 10-12-2008 08:08 PM
How2 View Code From Framework Classes? clintonG ASP .Net 1 10-26-2004 05:30 PM
Accomodating Obsolete Browsers -- How2? John McGaw HTML 31 01-12-2004 07:37 PM
Blank Data Fields, How2 Preserve Tbl Columns?, use &nbsp; Robert Kattke XML 0 12-31-2003 08:32 PM



Advertisments