protected void HotelsInformationEmptyFix(GridView grdView) { if (grdView.Rows.Count == 0) { ProjectCostingSheetAddTDS.HotelsInformationDataTable dt = new ProjectCostingSheetAddTDS.HotelsInformationDataTable(); dt.AddHotelsInformationRow(0, 0, 0, 0, false, 0, false, DateTime.Now, DateTime.Now, false, "", ""); Session["hotelsInformationDummy"] = dt; grdView.DataBind(); } // Normally executes at all postbacks if (grdView.Rows.Count == 1) { ProjectCostingSheetAddTDS.HotelsInformationDataTable dt = (ProjectCostingSheetAddTDS.HotelsInformationDataTable)Session["hotelsInformationDummy"]; if (dt != null) { // Hide row grdView.Rows[0].Visible = false; grdView.Rows[0].Controls.Clear(); } } }