.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

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

JIRA Workflow for Web Development Example: Simple and Effective 17th 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.

View Comments (0) ...
Navigation

Privacy Preference Center