Click here to Skip to main content
15,917,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
objModel Model is null &
public ClusterModel()

is not trigerring

What I have tried:

View Page:

@model COCSIntimation.Models.ISIProcessListModel

@{ Html.RenderPartial("_Cluster", Model.objModel); } Getting error at "Object reference not set to an instance of an object."


public class ISIProcessListModel
public ClusterDetails.ClusterModel objModel { get; set; }


public ActionResult Index()
ISIProcessListModel objProcessModel = new ISIProcessListModel();
return View(objProcessModel);

Class Library:

public class ClusterModel
public ObservableCollection<SelectListItem> Parameters;
public string MCLELDescription { get; set; }

public ClusterModel()
string companycode = HttpContext.Current.Session["iCompanyCode"].ToString();
int icompanycode = Convert.ToInt32(companycode);

string CECodes = "2,3,4,5,6,7";
SharedDA.GeneralClass obj = new SharedDA.GeneralClass();
DataSet objds = new DataSet();
objds = (DataSet)obj.GetClusterElements(1, CECodes);
var empList = objds.Tables[0].AsEnumerable().Select(dataRow => new ClusterModel { MCLELDescription = dataRow.Field<string>("MCLEL_Description") }).ToList();


Partial View:

@model ClusterDetails.ClusterModel

@(Html.EIPMVCLabel("lblIndependentCompany", @Model.MCLELDescription))
Updated 13-Mar-16 23:09pm
[no name] 14-Mar-16 3:35am    
At which line it throwing you exception?
Sathish km 14-Mar-16 4:41am    
@{ Html.RenderPartial("_Cluster", Model.objModel); }

Try like below:
@{Html.RenderPartial("_Cluster", new ViewDataDictionary(Model.MCLELDescription))};
Share this answer
Try like below:
@{Html.RenderPartial("", new ViewDataDictionary(Model.MCLELDescription))};
Share this answer

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

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