Results 1 to 4 of 4

Thread: How Eval() and Bind() methods differs in ASP

  1. #1
    Join Date
    Jan 2011
    Posts
    42

    How Eval() and Bind() methods differs in ASP

    I have taken an admission in BSc CS and I would be having a ASP.Net in my first year. The course has been started and I have came across one doubt now. Methods seems to be simple to use in ASP but I am getting confused between some methods. My biggest confusion is between the Bind() and Eval() methods that we use in ASP. Can somebody tell me how these methods differs from each other?

  2. #2
    Join Date
    Nov 2009
    Posts
    140

    Re: How Eval() and Bind() methods differs in ASP

    The syntax to perform the databinding to controls that use the template approach has changed from version 1.x to ASP.NET 2.0, since the method DataBinder.Eval (Container.DataItem, "Field"), which nevertheless continues to work has been overtaken by the arrival of the methods Eval () and Bind (). The Eval method, which is reflected in all the old DataBinder.Eval, or because it can accept a single parameter (the name of the field on which to databinding) or it can also add the formatting string of such data.

  3. #3
    Join Date
    May 2009
    Posts
    529

    Re: How Eval() and Bind() methods differs in ASP

    The Bind method, however, has been specifically designed for those controls that also support the update or insert data, as it allows for what has been called the "two way databinding" technique that is to bridge between the presentation of data and the writing in the data source. The method should be used in fact, within the template as EditItemTemplate or InsertItemTemplate, its controls such as GridView, FormView or the DetailsView.

    Code:
     <Asp: GridView ID = "grid" runat = "server" DataSourceID = "ObjectDataSource1" AutoGenerateColumns = "False">
    
      <Columns>
    
      <Asp: TemplateField>
    
      <ItemTemplate>
    
      <Asp: Image ID = "img" ImageUrl ='<%# Eval ("Img", "images / {0}")%> 'runat = "server" />
    
      </ ItemTemplate>
    
      <EditItemTemplate>
    
      <Asp: TextBox ID = "txt" Text ='<%# Bind ("Img")%> 'runat = "server" />
    
      </ EditItemTemplate>
    
      </ Asp: TemplateField>
    
      </ Columns>
    
      </ Asp: GridView>
    In addition, there are cases where, the Bind method must be used within the ItemTemplate template, as it may have to provide the data of such a column operation which is done server side, even if the specific column is not actually changed, as, perhaps, was marked as ReadOnly. It 's the case, these columns contain identifiers and unique keys.

  4. #4
    Join Date
    Apr 2009
    Posts
    488

    Re: How Eval() and Bind() methods differs in ASP

    Difference between bind and eval:

    • Bind (modified bidirectional)
    • Eval (reader only)

    Basically in a textBox instance, if you bind a variable, the change that you are doing in the textbox will be reflected in your variable, whereas with eval, the variable value will be displayed in your textbox, but if you modify cons value, this does not trickle into your variable.

Similar Threads

  1. How bluetooth differs from infrared in performance ?
    By Grayson in forum Technology & Internet
    Replies: 3
    Last Post: 25-11-2010, 06:53 AM
  2. The eval() method in Java
    By Isabella in forum Software Development
    Replies: 6
    Last Post: 11-08-2010, 05:05 PM
  3. Eval in bash shell
    By Carnie in forum Software Development
    Replies: 4
    Last Post: 12-03-2010, 09:52 PM
  4. Eval function in javascript
    By Solaris in forum Software Development
    Replies: 5
    Last Post: 02-03-2010, 05:59 PM
  5. Eval encoded file decoder
    By Tungesh in forum Software Development
    Replies: 1
    Last Post: 30-07-2009, 07:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,847,173.16701 seconds with 17 queries