This is a migrated thread and some comments may be shown as answers.

No parameterless constructor defined for this object

4 Answers 222 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dave Hayward
Top achievements
Rank 1
Dave Hayward asked on 25 Jan 2012, 07:47 PM

I'm  using ASP.NET MVC 3 technology and Telerik combobox in my project.

Here is how I'm populating the data:

mod.LangPref = new SelectList(new[]{
   new SelectListItem{ Text="English", Value="1"},
   new SelectListItem{ Text="French", Value="2"},
   new SelectListItem{ Text="German", Value="3"}
}, "Value", "Text", "2");

and populate the control in the view as follows:

@( Html.Telerik().DropDownList() 
    .Name("langpref") 
    .BindTo(new SelectList(mod.LangPref, "Value", "Text"))
    .HtmlAttributes(new { style = "width:150px; text-align: left" })
   

 

But when I attempt to update model using the 

TryUpdateModel(mod) function

 

I'm getting error message:

 

    "No parameterless constructor defined for this object."

Could you tell me what's wrong?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 26 Jan 2012, 07:21 AM
Hello Dave,

There is a known issue related with 2011.3.1306 version of Telerik Extensions for ASP.NET MVC. Please download the latest internal build and give it  a try. Let me know what your findings are. 

Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Clark
Top achievements
Rank 2
answered on 08 Feb 2012, 04:10 PM
I am getting the same error message with the menu control. I have tried previous versions of the control, but I am still getting the error. 

The only way I can make the application run is to remove the Action(string ActionName, string ControllerName ) functions, Which defeats the purpose of having a menu.

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
 
    <% Html.Telerik().Menu()
           .Name("NotificationMenu")
           .Items(menu => {
               menu.Add()
                   .Text("Notification")
                   .Items(item => {
                       item.Add()
                           .Action( "Index""Subscriber")
                           .Text("My Subscribers");
                       item.Add()
                           .Action("Create""Subscriber")
                           .Text("Add Subscriber");
                   });
           }).Render(); %>
  
0
Georgi Krustev
Telerik team
answered on 08 Feb 2012, 04:32 PM
Hi,

 
Check this forum thread for more information.

Kind regards,
Georgi Krustev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Doogle
Top achievements
Rank 1
answered on 17 Feb 2012, 09:06 PM
We encountered this when we started adding parameterized constructors to our controllers.
It seems that the menu control hits the default constructor to make sure that the action you specified is valid.
Your constructor either has to have no constructor (in which case a no-arg one is created for you behind-the-scenes) or if you have a parameterized constructor, you need to add a no-arg one so that the menu will not crash things.
Tags
ComboBox
Asked by
Dave Hayward
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Clark
Top achievements
Rank 2
Doogle
Top achievements
Rank 1
Share this question
or