-1

Model:

public class Everything
{
public List<MUSTERILER> Musteriler { get; set; }
public List<KISALTMALAR> Kisaltmalar { get; set; }
public List<ILETISIMLER> Iletisimler { get; set; }
public List<TEKLIFLER> Teklifler { get; set; }
public List<SEHIRLER> Sehirler { get; set; }
public List<ILCELER> İlceler { get; set; }
}

I combined all tables in one class :

public Everything Alltables()
{
return new Everything  // All Tables Here From Database
{
Musteriler = context.MUSTERILER.ToList(),
Iletisimler = context.ILETISIMLER.ToList(),
Teklifler = context.TEKLIFLER.ToList(),
Kisaltmalar = context.KISALTMALAR.ToList(),
Sehirler = context.SEHIRLER.ToList(),
İlceler = context.ILCELER.ToList(),
};
}

View:

using (Ajax.BeginForm("Index", new AjaxOptions { HttpMethod = "POST" }))
{
{
Html.DevExpress().DropDownEdit(
s =>
{
s.Name = "MusteriKaynagiDropdownEdit";
s.Text = Convert.ToString(Session["MusteriKaynagi"]);
s.Width = 250;
s.SetDropDownWindowTemplateContent(c =>
{
Html.DevExpress().ListBox(
listBoxSettings =>
{
listBoxSettings.Name = "KISALTMALAR_ACIKLAMA";
listBoxSettings.Properties.ValueField = "KISALTMALAR_ID";
listBoxSettings.Properties.TextField = "KISALTMALAR_ACIKLAMA";
listBoxSettings.Properties.ValueType = typeof(int);
listBoxSettings.Width = System.Web.UI.WebControls.Unit.Percentage(100);

listBoxSettings.Properties.ClientSideEvents.SelectedIndexChanged = "function(s, e) 
{ document.forms[0].submit(); }";
})
.BindList(Model.Kisaltmalar.Where(y => y.KISALTMALAR_AYRAC == 4).ToList())
.Bind(Model.Kisaltmalar)
.Render();
});
}
).GetHtml();
}
}

Controller:

public ActionResult Index(KISALTMALAR KISALTMALAR_ACIKLAMA)
{
return View(AllTables);
}

If ı choose an item to send to my actionresult, ı get this exception No parameterless constructor defined for this object

What to add , where to change any idea please ?

Mikhail
  • 9,186
  • 4
  • 33
  • 49
user2625648
  • 71
  • 1
  • 3
  • 8
  • possible duplicate of [ASP.NET MVC: No parameterless constructor defined for this object](http://stackoverflow.com/questions/1355464/asp-net-mvc-no-parameterless-constructor-defined-for-this-object) – Mikhail Aug 09 '13 at 09:42

1 Answers1

0

Here is the first search result through StackOverflow KB:

ASP.NET MVC: No parameterless constructor defined for this object

Impelement a dummy "parameterless constructor" for the Model type (a parameter of the "Index" method) to resolve this issue.

Community
  • 1
  • 1
Mikhail
  • 9,186
  • 4
  • 33
  • 49