Server Error in '/' Application.

DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'StateName'.

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.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'StateName'.

Source Error:


Line 23:         ddl.DataTextField = "StateName";
Line 24:         ddl.DataValueField = "StateId";
Line 25:         ddl.DataBind();
Line 26:         ddl.Items.Insert(0, new ListItem("-Select State-", ""));
Line 27:     }

Source File: c:\inetpub\vhosts\aquagrandservices.com\httpdocs\App_Code\Helper.cs    Line: 25

Stack Trace:


[HttpException (0x80004005): DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'StateName'.]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +3950422
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +36
   System.Web.UI.HtmlControls.HtmlSelect.OnDataBinding(EventArgs e) +381
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +178
   Helper.FillStates(HtmlSelect ddl) in c:\inetpub\vhosts\aquagrandservices.com\httpdocs\App_Code\Helper.cs:25
   services_in_area.Page_Load(Object sender, EventArgs e) in c:\inetpub\vhosts\aquagrandservices.com\httpdocs\services_in_area.aspx.cs:16
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533


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