I tried to create more than one combobox, but model to view combobox is different. then I tried to combine two models in one class, but I get an error "object reference not set to an instance of an object" when I click on the link to go to that page. please help me to fix the matter. thank you, sorry if I mess sentence. This piece from some source code : controller partial combobox ,
[ValidateInput(false)]
public ActionResult cbPartialCategoryDetail(string group)
{
SalesMonitoringDAC modelSM = new SalesMonitoringDAC();
MPMPRODUCTGROUPLINE item = new MPMPRODUCTGROUPLINE();
item.GROUPID = group;
List<string> mpmDetailCat = modelSM.GetProductGroupDetail(group);
return PartialView("_cbPartialCategoryDetail", mpmDetailCat);
}
and this is code combobox partial
@model DIS_iDealer.Models.SalesMonitoringModel
@Html.DevExpress().ComboBoxFor(m => m.mpmGroupLine.DESCRIPTION, settings =>
{
settings.Name = "Desc_ID_CB";
settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.Contains;
settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
settings.CallbackRouteValues = new { Controller = "Report", Action = "cbPartialCategoryDetail" };
settings.Properties.CallbackPageSize = 50;
settings.Properties.ValueField = "DESCRIPTION";
settings.Properties.TextField = "DESCRIPTION";
settings.Properties.ValueType = typeof(string);
settings.Width = 100;
settings.Properties.DropDownWidth = 100;
settings.SelectedIndex = 0;
settings.Properties.ClientSideEvents.BeginCallback = "function(s, e) { e.customArgs['GroupId'] = Category_Id_CB.GetValue(); }";
settings.Properties.ClientSideEvents.SelectedIndexChanged = "OnInitDetailCategory";
settings.Properties.ClientSideEvents.Init = "OnInisialDetailCategory";
settings.Properties.ValidationSettings.ErrorTextPosition = ErrorTextPosition.Right;
settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
settings.Properties.ValidationSettings.Display = Display.Dynamic;
settings.Enabled = true;
settings.ShowModelErrors = true;
//}).BindList(ViewBag.DetailCategory).GetHtml()
}).BindList((new DIS_iDealer.DataAccess.SalesMonitoringDAC()).GetProductGroupDetail(Model.mpmGroupLine.GROUPID)).GetHtml()
this is class two combine the two model
namespace DIS_iDealer.Models
{
public class SalesMonitoringModel
{
public MPMPRODUCTGROUPLINE mpmGroupLine { get; set; }
public MPMDataDealer mpmDataDealer { get; set; }
public SalesMonitoringModel(MPMPRODUCTGROUPLINE _mpmGroupLine, MPMDataDealer _mpmDataDealer) {
mpmGroupLine = _mpmGroupLine;
mpmDataDealer = _mpmDataDealer;
}
}
}