.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Why we use Eval() nad Bind() function in asp.net

Posted By: Tanmoy     Posted Date: July 09, 2012    Points:5   Category :ASP.Net
Why we use Eval() nad Bind() function in asp.net and what is the difference between this two.

Responses
Author: Sreeraj Nair Mungath             
Posted Date: July 10, 2012     Points: 20   

Difference Between Eval And Bind in asp.net



Eval is Unidirectional where as Bind is Bi-Directional.
Eval can combine more than two filed where as Bind can not do this Operation.

Author: Sandip Narawade             
Posted Date: July 23, 2012     Points: 20   

Eval() and Bind() in asp.net

for binding datatable columns to the gridview......

<asp:TemplateField HeaderText="Length">
<ItemTemplate>
<asp:Label ID="lblLength" runat="server" Text='<%#Eval("FieldLength") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtFieldLength" runat="server" Text='<%#Bind("FieldLength") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

FieldLength is a data column name


Author: Tanmoy             
Posted Date: July 23, 2012     Points: 20   

@ Sandip Narawade thanks for your response.But in which situation should I use Eval() And when to use Bind(). what is the difference between these two.

Author: Tanmoy             
Posted Date: July 23, 2012     Points: 20   

@Sreeraj Nair Mungath .Thanks for your answer.Can you please give me an example?

Author: Sandip Narawade             
Posted Date: July 24, 2012     Points: 20   

Evel("<fildname>") 1. is a method will retrive data object data to Eval() location. 2. Evel() is used to one-way communication i.e we can only use Evel() to retrive data from data object. 3. Evel() is always return object.

Bind(<fieldname>) 1. is a method will retrive data as well as update the data object data 2. Bind() is used to two-way communication i.e retrive as well as update . 3. Bind() is always depend on the control object bcz control object having facility for two-way communication also.


Author: Tanmoy             
Posted Date: July 26, 2012     Points: 20   

@ Mr.Narawade

That means Eval should be used in <ItemTeamplate> as it is used only for retrive data.
And Bind used in <EditItemTemplate> as it is used for retrive as well as update the data.

is this correct?



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend