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: 18 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:













databinding issues

white spaces after #region is removed upon formatting document

add-in not displayed

visual studio interfears with outlook

can not drag and drop controls where i want to.

statement completion in visual basic

web crawler source code urgently needed

whidbey web app and sharepoiny

force overwriting readonly files with copy task (msbuild)

vb.net, c#, and the ide

walkthroughs and samples for asp.net 2.0

build errors in visual studio 2008

cannet add a new web page!!!!! help please :(

how to do 'add existing item' in v2.0 programmatically?

error prj0050: failed to register output. please ensure you have the appropriate permissions to modify the registry.

project reference and resource file issue

web deployment and *.compiled files

reinstalling vs 2005 upgrade on my new computer.

vb on mac

how to create dll for a web apllication developed

2005 and 2003

home page

customizing vs2005 start page?

problems with properties window in visual studio 2005

multiple versions of .net frameworks giving problem

increment label number inside for loop

are they going occur problem to install .net both 2003 & 2005 in one pc and one windows ????

control events in vs 2005

how to recover the setting by the macro, toggletexteditorgrayscale

dataset vs sqldatasource

[skins] error in code-view: no build provider registered for the extensions '.skin'

adding user control (.ascx) display issue

debug -> exceptions menu

web application project and resources files

move files to web server

unable to cast object of type 'system.web.ui.page' to type 'carealways.usercontrols.pagebase'

global resource file

how do you turn intellisense back 'on'

reverse engineering tools

web deployment - generating application in virtual directory

how to dynamically create a solution file

how to connect to a web site under source safe

view code option mising from popup menu

asp not asp.net files

how to build a website that contains multiple sub-project?

location of web reference proxy class

vs2005 doesn't like 1.1 after install. what to do?

cannot use certain buttons after removing columns in gridview

how can i make one solution with many projects in vs2005?

source safe database location changed... how to bind existing solution

   
  Privacy | Contact Us
All Times Are GMT