Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the difference between <%#%> and <%=%>?

Answers were Sorted based on User's Feedback



What is the difference between <%#%> and <%=%>?..

Answer / archana

The <%= expressions are evaluated at render time
The <%# expressions are evaluated at DataBind() time and
are not evaluated at all if DataBind() is not called.

Is This Answer Correct ?    8 Yes 0 No

What is the difference between <%#%> and <%=%>?..

Answer / amit kumar

<%# %> is used for databinding
like <%#Eval("id") %>OR <%#Bind("id") %>
<%=%> is used only for printing something
like <%= DateTime.Now.ToString()%>

Is This Answer Correct ?    3 Yes 0 No

What is the difference between <%#%> and <%=%>?..

Answer / vinodh reddy

I was a little confused about the difference between <%=
expression %> and <%# expression %> in ASP.NET. It seems
like both work in a lot of cases, but in other cases, only
the # (data binding) version works. So, I decided to dig
into it a little bit. To try it out I built this simple
page:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_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>Untitled
Page</title></head><body> <form id="form1"
runat="server"> <div> <p>Equals: <%=
this.TestValue %></p> <p>Pound: <%# this.TestValue %
></p> <p>Equals label: <asp:Label runat="server"
ID="_equals" Text="<%= this.TestValue %>" /></p>
<p>Pound label: <asp:Label runat="server" ID="_pound"
Text="<%# this.TestValue %>" /></p> </div>
</form></body></html>
And the code behind is:

public partial class _Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e)
{ _testValue = "2"; } protected void
Page_PreRenderComplete(object sender, EventArgs e)
{ // DataBind(); _testValue = "3"; }
public string TestValue { get { return
_testValue; } } private string _testValue = "1";}
Here's what the result is when the DataBind() line is
commented out:

Equals: 3

Pound:

Equals label:

Pound label:

And, when it's not commented out:

Equals: 3

Pound: 2

Equals label:

Pound label: 2

At first glance it looks like the Equals label case did
nothing. But, if you view source, you see:

<p>Equals label: <span id="_equals"><%= this.TestValue %
></span></p>

The literal expression made it down to the browser and it's
just invalid HTML. What you can see as a result is:

The <%= expressions are evaluated at render time
The <%# expressions are evaluated at DataBind() time and
are not evaluated at all if DataBind() is not called.
<%# expressions can be used as properties in server-side
controls. <%= expressions cannot.

Is This Answer Correct ?    0 Yes 0 No

What is the difference between <%#%> and <%=%>?..

Answer / hr@tgksolutions.com

While === examines both equality and data type—that is, a value must be of the same type—the == operator merely checks equality.

Is This Answer Correct ?    0 Yes 0 No

What is the difference between <%#%> and <%=%>?..

Answer / ravindarjobs

have a look at this link


http://blogs.msdn.com/dancre/archive/2007/02/13/the-
difference-between-lt-and-lt-in-asp-net.aspx

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

Define state managenent?Descibe state managenent technique which maintain the information at server site focusing it IDS features and limitations?

1 Answers  


What are the difference between ASP and ASP.Net?

4 Answers   Accenture, Mphasis,


can we remote debug applications with the remote debugger installed with vs.net 2002, with vs.net 2003?

0 Answers  


How many web config files can be created for an application?

0 Answers  


What is the difference between a cookie and a pixel?

0 Answers  


Briefly describe different techniques for ASP.NET State Management?

6 Answers   Deloitte, Syntax Softtech,


You have been given the task of designing a web services to expose the data that is stored in a database on the server. In order to successfully build the web services, you need to import some namespaces. What is the minimum namespace you need to import? a) System.Web b) System.WebServices c) System.Web.Services d) System.Web.ServiceModel

2 Answers   Syntax Softtech,


Is data edited in the Repeater control?

0 Answers   Siebel,


Mention the execution process for managed code?

0 Answers  


What are the advantages of asp.net mvc framework? : asp.net mvc

0 Answers  


If Asp Dot Application is stateless what happened? during designing

3 Answers   TCS,


How to register exception filter globally?

0 Answers  


Categories