ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  ASP.NET
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 SharePoint interview questions  SharePoint Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
What is the difference between <%#%> and <%=%>?
 Question Submitted By :: Lakshmi
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the difference between <%#%> and <%=%>?
Answer
# 1
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 ?    4 Yes 0 No
Archana
 
  Re: What is the difference between <%#%> and <%=%>?
Answer
# 2
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 0 No
Ravindarjobs
[IGSA LABS]
 
 
 
  Re: What is the difference between <%#%> and <%=%>?
Answer
# 3
<%# %> is used for databinding
like <%#Eval("id") %>OR <%#Bind("id") %> 
<%=%> is used only for printing something 
like <%= DateTime.Now.ToString()%>
 
Is This Answer Correct ?    2 Yes 0 No
Amit Kumar
 
  Re: What is the difference between <%#%> and <%=%>?
Answer
# 4
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
Vinodh Reddy
 

 
 
 
Other ASP.NET Interview Questions
 
  Question Asked @ Answers
 
What is the use of SmartNavigation property?  2
How do you handle unhandled exceptions in ASP.NET?.  3
Why is catch(Exception) almost always a bad idea?  3
In try catch blocks one is normal catch block and another is sqlcatchexception block Microsoft3
How to write unmanaged code and how to identify whether the code is managed /unmanaged? Accenture4
Name two properties common in every validation control?  1
what is the difference b/w .net 1.1 and 2.0 ? Polaris2
Can you explain what inheritance is and an example of when you might use it?  3
what is view state? Satyam9
What is CTE in sql server 2005? Minecode2
How do I debug an ASP.NET application that wasn't written with Visual Studio.NET and that doesn't use code-behind?  1
version information of assembly consist of _________ values. AG-Technologies3
what is strong name? Microsoft2
Why is validation always done on the server? When does that occur?  1
How to write unmanaged code and how to identify whether the code is managed / unmanaged ? Accenture1
How does the XmlSerializer work? What ACL permissions does a process using it require?  1
In which form does the dataset store data in it? Verinon-Technology-Solutions3
What is the roll of JIT in asp.net?  4
WHT IS DIFFERENCES BETWEEN HTML CONTROLS AND SERVER CONTROLS. HCL9
Way of updating a table other than stored procedure and hard coded query?  2
 
For more ASP.NET Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com