DetailsView
DataTable dt = new DataTable(); dt = vm.Gridfill(vm); if (dt.Rows.Count > 0) { DetailsView1.DataSource = vm.Gridfill(vm); DetailsView1.DataBind(); } else { DetailsView1.ChangeMode(DetailsViewMode.Insert); }
Server Error in '/' Application. Object reference not set to an instance of an object. 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.NullReferenceException: Object reference not set to an instance of an object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] AjaxControlToolkit.MaskedEditExtender.OnLoad(EventArgs e) +135 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Control.LoadRecursive() +131 System.Web.UI.Control.AddedControl(Control control, Int32 index) +318 System.Web.UI.ControlCollection.Add(Control child) +146 System.Web.UI.WebControls.CellControlCollection.Add(Control child) +34 System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +33 System.Web.UI.WebControls.CellControlCollection.AddAt(Int32 index, Control child) +40
DataBind
IsPostBack
Page_Load
private void Page_Load() { if (!IsPostBack) { // All your Binding codes here. } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)