View
@{Html.RenderPartial("BattingGridPartial", Model.Batting);
@{Html.RenderPartial("BowlingGridPartial", Model.Bowling);
Controller
[HttpPost]
public ActionResult LoadGrid()
{
var Model = new ICCEntities();
Model = null;
try
{
string r;
r = Session["Report"].ToString();
IEnumerable SelectedReportId = r.Split(',');
IEnumerator ReportIds = SelectedReportId.GetEnumerator();
while (ReportIds.MoveNext())
{
if (ReportIds.Current == "1")
{
Model = new ICCEntities();
Session["ReportId"] = "1";
Model.Batting = GetList();
}
if (ReportIds.Current == "2")
{
Session["ReportId"] = "2";
Model.Bowling = GetList();
}
}
catch
{
}
return View(Model);
}
Model
public List Batting { get; set; }
public List Bowling { get; set; }
I am able to fetch data in to Model in controller but it is not returning any grid in view... On load it is giving me error object reference is null in Model.Bowling in View, Please Help me in Same
Jaganathan BantheswaranPosted Oct 22, 2013, 5:43 AM
At top of your view, add this line,
@model ICCEntities