Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We migrated our web application VS 2008 to VS 2010 and EntitySpaces 2007 to EntitySpaces 2010. Here we are phasing an issue while saving an entity.

Issue is:
we have a formview in aspx page and it is using "ObjectDatasource" as datasource. Formview has couple of controls like "Textbox" and "dropdownlist". When we are adding new data and click save, then Formview.DataBind() is giving an error:

Error :Object reference not set to an instance of an object.

Stack Trace:
System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
  Source=EntitySpaces.Core
  StackTrace:
       at EntitySpaces.Core.esEntity.System.ComponentModel.ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
       at EntitySpaces.Core.esEntity.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
       at System.ComponentModel.TypeDescriptor.MergedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
       at System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes)
       at System.Web.UI.DataBinder.GetPropertiesFromCache(Object container)
       at System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName)
       at System.Web.UI.WebControls.FormView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
       at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
       at System.Web.UI.WebControls.FormView.PerformDataBinding(IEnumerable data)
       at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
       at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
       at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
       at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
       at System.Web.UI.WebControls.FormView.DataBind()
       at Rules_Rules_Rule.PopulateRule() in C:\05272011\Backup_fully working 3.0\Web_Updated_Framework\Visa.IntelliLink.WebApp\Rules\Rules\Rule.aspx.cs:line 322
       at Rules_Rules_Rule.GridViewRules_RowCommand(Object sender, GridViewCommandEventArgs e) in C:\05272011\Backup_fully working 3.0\Web_Updated_Framework\Visa.IntelliLink.WebApp\Rules\Rules\Rule.aspx.cs:line 312
       at System.Web.UI.WebControls.GridView.OnRowCommand(GridViewCommandEventArgs e)
       at System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
       at System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e)
       at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
       at System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e)
       at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
       at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
       at PeterBlum.DES.LinkButton.OnCommand(CommandEventArgs e)
       at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: 


Thanks in advance.
Posted
Updated 13-Jun-11 18:01pm
v2
Comments
Firo Atrum Ventus 13-Jun-11 22:45pm    
Where is the source code?
RakeshMeena 14-Jun-11 0:50am    
Did you debug your code?

Hi,

Because you data source is NULL. That's why this error please check whether the value is coming to your dataset or object

Happy coding
 
Share this answer
 
v2
You are probably trying to access a property or a method of an object that is null.
Hence the error.

Try to step through by debugging through the code.
 
Share this answer
 
Here the property or a method which you are trying is Null, so only the error.

Just check it by Debugging your code.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900