DataBinding Method Such as Eval(),XPath(), and Bind() can Only be used in the Context of a databound Control.

 
Problem: - DataBinding Method Such as Eval(),XPath(), and Bind() can Only be used in the Context of a databound Control.

Solution :-   Use  DataBinder.Eval(Container.DataItem,"field_name")  Method

                    Instead of  Eval(“field_name”)

Description :- 

This Error Mainly Cause Because Of using Eval(“field_name”) Method to bind Control in Grid view.  Instead of Eval Method if we use DataBinder.Eval(Container.DataItem,"field_name") the Error Got Solved. I am Using Grid view from Last 2 Years but never got this Error before. But One Day When I use Nested Grid view this Error throw by .Net Compiler. If there is Only One grid view then Eval method is ok. Please if you have any extra Information Comment On this. In Comment Please Write How’s u got this Error and Solution you have done for this.


Thank you.

Posted in | 13 comments