CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > general_asp.net.getting_started Tags:
Item Type: Date Entered: 7/5/2007 1:39:13 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 4 Views: 11 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
"MrPimp" <>
NewsGroup User
<% %> vs <%= %>7/5/2007 1:39:13 PM

0

Hi there!

Anyone knows what is the difference between the <% %> and the <%= %> syntax?  Or where can I find references about the diferent inline syntax?

 Thanks for the insight!


Regards,
Pascal Marier-Dionne,
Web Developer.
Quebec, Canada
"Curt_C" <>
NewsGroup User
Re: <% %> vs <%= %>7/5/2007 2:02:36 PM

0

<% %> is just a block wrapper for server execution.

<%= %> is saying to write it to the screen. It's like a Response.Write().


Curt Christianson
Chief Architect, df-Software.com
df-Software.com | StarterKits.org | Darkfalz.com | WebHost4Life | Microsoft MVP
"MrPimp" <>
NewsGroup User
Re: <% %> vs <%= %>7/9/2007 8:37:14 PM

0

OK.  Thanks.

But then, is there a reference indicating where those construct are usable?

Like, I think I can use it in a server control tag, but not in a html or style tag.

Exemple:

<td background='<% System.String.Format("{0}7.gif", Global.GetPath(RessourceType.Image)); %>' valign="middle" style="width: 190px; text-align: center; height: 41px;">

or

<td style='width: 997px; height: 55px; background-image: url(<% String.Format("{0}4.gif", Global.GetPath(RessourceType.Image)); %>);' valign='bottom'>

will compile but return nothing in the background style definition

(<td background='' valign="middle" style="width: 190px; text-align: center; height: 41px;">

 or

 <td style="width: 997px; height: 41px; background-image: url();">),

but when I use the other construct:

<td background='<%= System.String.Format("{0}7.gif", Global.GetPath(RessourceType.Image)); %>' valign="middle" style="width: 190px; text-align: center; height: 41px;">

 or

<td style='width: 15px; background-image: url(<%= System.String.Format("{0}8.gif", Global.GetPath(RessourceType.Image)); %>); height: 41px;'>

I get a compile error saying that a ')' was expected, and another one telling me that ')' is an invalid expression term...


Regards,
Pascal Marier-Dionne,
Web Developer.
Quebec, Canada
"MrPimp" <>
NewsGroup User
problem occured7/9/2007 8:47:45 PM

0

...


Regards,
Pascal Marier-Dionne,
Web Developer.
Quebec, Canada
"MrPimp" <>
NewsGroup User
Re: problem occured7/9/2007 9:08:29 PM

0

Finally found a workaround!

Thank you Curt_C, <%= %> is effectively like a response.write, but one that you cannot use outside of JavaScript blocks (at least, seemingly...)

You can use it in Ajax javascript function definitions to feed server results to a function

(like so: 

function UserTabChanged(sender, e)
{
    __doPostBack('<%= tcConfPers.ClientID %>', sender.get_activeTab().get_headerText());
}

 )

But to achieve the same results in a HTML tag or in a style definition, you have to use a Response.Write in the Server block,

like so: 

'width: 15px; background-image: url(<% Response.Write(System.String.Format("{0}8.gif", Global.GetPath(RessourceType.Image))); %>); height: 41px;'> or '<% Response.Write(System.String.Format("{0}9.gif ", Global.GetPath(RessourceType.Image))); %>' valign="top" style="height: 41px; width: 5000000px;">

 Et voil?!

Hope it helps somebody else out there as it helped me!

Thank you again to M. Curt_C!


Regards,
Pascal Marier-Dionne,
Web Developer.
Quebec, Canada
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:













string was not recognized as a valid datetime.

value of asp:label in sql query

can't find ashx file

dotnetnuke

referer url

scope of variables in global.asax

creating dynamic forms - possible?

htmlinputhidden created dynamically error

connecting to sql server code !!!

asp.net - win 98 - pws

difference betweeen .aspx and .ascx?

move pointer type object in client window

dataset column totals

can you preload image from the code behind?

grouping excel help

delegates

layout problems

pass sql query to another page safely.

more newbie questions

automactic re-direct?

email notification of newlistings, i'm almost there.

asp.net looking for login.aspx. why?

converting html href to asp.net button?

date format

asp.net: fill textbox from a dropdownlist

how to implement local search in asp.net 2.0 web application?

datasethelper?

can i import namespaces into my globla.asax file?

difficulty executing sql stored procedure from vb code - seems to run twice!

deployment problem vwd 2005 express --> hosting company

rss feeds

gmail en html in body

how to control incorrect date error message?

beginner needs pointing in the right direction

file download from server

trouble installing msde

detecting user's local privilleges

question on asp.net project

vb and c#

change uppercase and lowercase on string

string covert to datetime

online document previewing

user controls and the page_load event

store variable

display database records with fields matching values of selected checkboxes

panel issues

change the language of the page contents

encoding question

help with acmevb

error comparing byte() to byte()?

   
  Privacy | Contact Us
All Times Are GMT