We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Error No parameterless constructor defined for this object

Thread ID:

Created:

Updated:

Platform:

Replies:

103139 Apr 4,2012 11:56 AM Apr 12,2012 01:04 AM ASP.NET MVC (Classic) 1
loading
Tags: Grid
Marc Oden
Asked On April 4, 2012 11:56 AM

I am recieve the following error when I attempt to use the GridEditMode.ExternalForm editting mode:

No parameterless constructor defined for this object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.

Source Error:


Line 123:
Line 124:

Line 125: <%= Html.Syncfusion().Grid("TestUsers")
Line 126: .Datasource(Model.SearchResults)
Line 127: .Caption("Users")


Source File: c:\UID\AMC\UIDWebSite\Views\Account\TestUsers.aspx Line: 125

Stack Trace:


[MissingMethodException: No parameterless constructor defined for this object.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance() +103
Syncfusion.Mvc.Grid.GridValidatorHtmlBuilder`2.RenderValidationHelpers(GridColumn`1 col, HtmlHelper helper) +41
Syncfusion.Mvc.Grid.<>c__DisplayClass17.b__16(GridColumn`1 column) +96
Syncfusion.Linq.FunctionalExtensions.ForEach(IEnumerable`1 items, Action`1 action) +151
Syncfusion.Mvc.Grid.GridEditRenderer`1.RenderEditForm() +392
Syncfusion.Mvc.Grid.GridEditRenderer`1.GetEditForms() +580
Syncfusion.Mvc.Grid.Grid`1.InitializeEditing(HtmlTag grid) +119
Syncfusion.Mvc.Grid.Grid`1.CreateGrid() +118
Syncfusion.Mvc.Grid.GridBuilder`1.Render() +279
Syncfusion.Mvc.Grid.GridBuilder`1.ToString() +5
System.Web.HttpWriter.Write(Object obj) +27
System.Web.Mvc.SwitchWriter.Write(Object value) +15
System.Web.UI.HtmlTextWriter.Write(Object value) +37
ASP.views_account_testusers_aspx.__RenderContent2(HtmlTextWriter __w, Control parameterContainer) in c:\UID\AMC\UIDWebSite\Views\Account\TestUsers.aspx:125
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\UID\AMC\UIDWebSite\Views\Shared\Site.Master:35
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +56
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

The following code is from my View:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>
<%@ Import Namespace="AMCMarking.Models" %>

Search Users











Search Users



<% using (Html.BeginForm()) { %>
<%: Html.ValidationSummary(true, "User search was unsuccessful.") %>



User Search Parameters


























<%: Html.LabelFor(m => m.UserName) %> <%: Html.LabelFor(m => m.Roles)%> <%: Html.LabelFor(m => m.IsApproved)%>


<%: Html.ValidationMessageFor(m => m.UserName) %>

<%: Html.TextBoxFor(m => m.UserName) %>



<%: Html.ValidationMessageFor(m => m.Roles)%>

<%: Html.DropDownList("RoleListClass", (SelectList)ViewData["rolelist"], new { style = "width:150px;" })%>


<%: Html.ValidationMessageFor(m => m.IsApproved)%>

<%: Html.DropDownList("IsApprovedListClass", (SelectList)ViewData["isapprovedlist"], new { style = "width:75px;" })%>
<%: Html.LabelFor(m => m.LastName) %> <%: Html.LabelFor(m => m.FirstName) %> <%: Html.LabelFor(m => m.MiddleName)%>


<%: Html.ValidationMessageFor(m => m.LastName) %>

<%: Html.TextBoxFor(m => m.LastName, new { style = "width:14em" })%>


<%: Html.ValidationMessageFor(m => m.FirstName) %>

<%: Html.TextBoxFor(m => m.FirstName, new { style = "width:13.3em" })%>


<%: Html.ValidationMessageFor(m => m.MiddleName)%>

<%: Html.TextBoxFor(m => m.MiddleName, new { style = "width:13em" })%>



    






<%: Html.LabelFor(m => m.SearchResults)%>




<%= Html.Syncfusion().Grid("TestUsers")
.Datasource(Model.SearchResults)
.Caption("Users")
.Column(cols =>
{
cols.Add(m => m.UserName);
cols.Add(m => m.LastName);
cols.Add(m => m.FirstName);
cols.Add(m => m.MiddleName);
cols.Add(m => m.Role);
cols.Add(m => m.IsApproved);
cols.Add(m => m.IsLockedOut);
})
.ToolBar(tool =>
{
tool.Add(GridToolBarItems.Search)
.Add(GridToolBarItems.Edit)
.Add(GridToolBarItems.Delete);

})
.Mappers(mapper =>
{
mapper.DeleteAction("JSONDelete");
})
.Editing( edit=>{
edit.ExternalForm(ef =>
{
ef.TargetID("TestUser");
ef.Position(ExternalFormPosition.BottomLeft);
});
edit.AllowDelete(true)
.AllowEdit(true);
edit.EditMode(GridEditMode.ExternalForm);
edit.ExternalModeEditorTemplate("EditUser");
edit.PrimaryKey(key => key.Add(m => m.UserID));

})
.ActionMode(ActionMode.JSON)
.AutoFormat(Skins.Blueberry)
.EnableSorting()
.AllowSearching(true)
.EnableFiltering()
.EnablePaging().SortSettings(sort => { sort.AllowMultiSorting(true); })
%>








" id="BiometricWSURL" />
<%: Html.Hidden("PersonIDString", "")%>






<% } %>


The following code is from my controller:

public ActionResult TestUsers()
{
string errormessage = string.Empty;
GetUsersModel ums = new GetUsersModel();
UserProvider up = new UserProvider();
try
{
if (!_provider.IsUserLoggedOn())
{
return RedirectToAction("LogOn", "Account");
}

if (ModelState.IsValid)
{
ViewData["rolelist"] = ums.Roles;
ViewData["isapprovedlist"] = ums.IsApproved;

ums.SearchResults = up.SearchUsers(ums.UserName, ums.SelectedRoleValue, ums.LastName, ums.FirstName, ums.MiddleName, ums.SelectedIsApprovedValue, out errormessage);
ums.SearchResults = ums.SearchResults.Take(20).ToList();
return View(ums);
}

}
catch (Exception e)
{
ModelState.AddModelError("", e.ToString());
}
ums.SearchResults = new List();
return View(ums);
}


[AcceptVerbs(HttpVerbs.Post)]
public ActionResult TestUsers(PagingParams args, int? UserID)
{
if (!_provider.IsUserLoggedOn())
{
return RedirectToAction("LogOn", "Account");
}

UserProvider up = new UserProvider();
string errormessage = string.Empty;
if (UserID.HasValue)
{
RequestType currentRequest = (RequestType)Convert.ToInt32(args.RequestType);
if (currentRequest == RequestType.BeginEdit)
{

EditUserModel thisUser = up.GetEditUserByUserID(UserID.Value, out errormessage);
if (string.IsNullOrEmpty(errormessage))
{
return PartialView("EditUser", thisUser);
}
else
{
ModelState.AddModelError("", errormessage);
}
}
}

GetUsersModel ums = new GetUsersModel();
ums.SearchResults = up.SearchUsers(ums.UserName, ums.SelectedRoleValue, ums.LastName, ums.FirstName, ums.MiddleName, ums.SelectedIsApprovedValue, out errormessage);
IEnumerable data = ums.SearchResults.Take(20).ToList();
ActionResult result = data.GridJSONActions();
return result;
}








Ranjithkumar R G [Syncfusion]
Replied On April 12, 2012 01:04 AM

Hi Marc,

Thanks for using Syncfusion products.

We have analyzed your code snippet but we are unable to track the issue which you are facing. So we have created a simple sample which illustrates the behavior of ExternalForm edit mode.

Please refer to the below link to download the sample application.

http://www.syncfusion.com/downloads/Support/DirectTrac/General/Sample-661527899.zip

Could you please try the above sample and get back to us whether you are able to reproduce the issue? If not, could you please give more information or by reproducing the issue in the above sample so that we could sort out the issue and provide you with solution. The information provided would be of great help in resolving the issue.

Please let us know if you have any concerns.

Regards,
Ranjithkumar



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;