.NET Daily

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

Introduction

Darius

Darius

Darius Dumitrescu is a creative Senior CMS Consultant with in depth .NET knowledge, focused on Web Development and Architecture Design.


LATEST POSTS

My View on the Life cycle of a Fixed Cost Web Project 01st July, 2018

How to Deliver Accurate Project Status Reports 21st April, 2018

Common .NET Exceptions

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

Posted on .

Error: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

Scenario1: You have created a repeater or gridview that looks like this:


    
        
            
                
                
                
            
    
    
        
            
            
            
        
    
    
        
                    First Name                                      Last Name                                      Email                 
                <%= Eval("FirstName") %>                              <%= Eval("LastName") %>                              <%= Eval("Email") %>             
                  

Scenario1: Please pay attention at the server tags format <%= Eval("FirstName") %>

Resolution 1 of Scenario 1: Try to format the server tag like this: <%#Eval("FirstName")%> ;
Resolution 2 of Scenario 1: If you are using as DataSource other provider that SQL, also try a server tag format that looks like this: <%#DataBinder.Eval(Container.DataItem,"field")%>;

Darius

Darius

Darius Dumitrescu is a creative Senior CMS Consultant with in depth .NET knowledge, focused on Web Development and Architecture Design.

There are no comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

View Comments (0) ...
Navigation