Server Error in '/' Application.

DataTable must be set prior to using DataView.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.DataException: DataTable must be set prior to using DataView.

Source Error:


Line 7:  
Line 8:  var allBranches = new Array(<%
Line 9:  BranchesDV.Sort = "Name";
Line 10: for(int i=0; i<BranchesDV.Count; i++)
Line 11: {

Source File: c:\work\professors\Default.aspx    Line: 9

Stack Trace:


[DataException: DataTable must be set prior to using DataView.]
   System.Data.DataView.CheckSort(String sort) +2164192
   System.Data.DataView.set_Sort(String value) +158
   ASP.default_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\work\professors\Default.aspx:9
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +117
   System.Web.UI.Page.Render(HtmlTextWriter writer) +39
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +79
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8753


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4081.0