Replies
I am having the same issue but with a partial view but can't seem to get it to work no matter which way i do it i get undefined is not a function. I am calling the partial view from button click in ajax and passing an id that is used in the query to build the queryable list.
Main view:
@using Infragistics.Web.Mvc
@model NOMISe.eSIMON.Web.UI.Areas.Admin.Models.SystemFeatureViewEditModel
@{
ViewBag.Title = "Index";
}
@(Html.Infragistics().Loader()
.ScriptPath("../Scripts/infragistics/js")
.CssPath("../Content/infragistics/css")
.Render()
)
@(Html.Infragistics().ComboFor(feature => feature.AvailableFeature.FirstOrDefault().Name)
.ID("featureSelect")
.Width("150px")
.DataSource(Model.AvailableFeature.AsQueryable())
.CaseSensitive(false)
.ValueKey("ID")
.TextKey("Name")
.FilteringCondition("contains")
.FilteringType(ComboFilteringType.Local)
.RenderMatchItemsCondition(ComboRenderMatchItemsCondition.Contains)
.DataBind()
.Render()
)
//
$(function () {
$("#getDetails").click(event, function () {
var value = $("#featureSelect").igCombo("value");
$.ajax({
type: 'GET',
url: '@Url.Action("GetFeatureSecurities", "SystemAdmin")',
data: { "id": value },
success: function (data) {
$("#featureSecurityList").html(data);
},
error: function () {
$("#featureSecurityList").html("
There was an error.
");
}
})
})
})
// ]]>
Controller section that if fired
public ActionResult GetFeatureSecurities(string id)
{
ObjectSecurityDTOModel viewModel = new ObjectSecurityDTOModel();
IEnumerable securityList = from o in objectSecurityService.FindByObjectID(new Guid(id))
select new ObjectSecurityDTOModel.ObjectSecurityDTO
{
ID = o.ID,
RoleName = "",//o.Role.Name,
//SecurityMask = o.SecurityMask,
AllowDeny = o.Granted,
CreateBy = "",//o.CreatedBy.DisplayName,
DateCreated = o.DateCreated,
ModifiedBy = "",//o.ModifiedBy.DisplayName,
DateModified = o.DateModified
};
viewModel.ObjectSecurityDTOs = securityList;
return View("_FeatureSecurityList", viewModel.ObjectSecurityDTOs.AsQueryable()); //.ObjectSecurityDTOs.AsQueryable()
}
#endregion
//
// GET: /Admin/SystemAdmin/
public ActionResult Index()
{
SystemFeatureViewEditModel viewModel = new SystemFeatureViewEditModel();
SetupFeatureList(viewModel);
return View(viewModel);
}
Partial view:
@using Infragistics.Web.Mvc;
@model IEnumerable
@(Html.Infragistics().Loader()
.ScriptPath("../Scripts/infragistics/js")
.CssPath("../Content/infragistics/css")
.Render()
)
@(Html.Infragistics()
.Grid(Model.AsQueryable())
.ID("featureSecurities")
.Columns(column =>
{
column.For(x => x.ID).HeaderText("ID").DataType("string").Hidden(true);
column.For(x => x.RoleName).HeaderText("Role Name").DataType("string");
//column.For(x => x.SecurityMask).HeaderText("Security Mask").DataType("int");
column.For(x => x.AllowDeny).HeaderText("Allowed/Denied").DataType("bool");
column.For(x => x.CreateBy).HeaderText("Created By").DataType("string");
column.For(x => x.DateCreated).HeaderText("Date Created").DataType("date");
column.For(x => x.ModifiedBy).HeaderText("Modified By").DataType("string");
column.For(x => x.DateModified).HeaderText("Date Modified").DataType("date");
})
.Features(features =>
{
features.Filtering();
features.Selection().Mode(SelectionMode.Row).MultipleSelection(false).Activation(false);
})
.Width("75%")
.Height("325px")
.PrimaryKey("ID")
.DataSource(Model.AsQueryable())
.DataBind()
.Render()
)
I remebered that i couldn't have datasource set if i passed the data at .Grid(). One error is in my code saying undefiend is not a function and the other is in the infragistics/js/modules/infragistics.ui.grid.framework.js:25.
I am not sure what combination of changes finally got the grid to show but it now shows and returns data. I did have it just as my viewModel returning and not a list and it never would return. But i changed it to a list of users and it worked just fine. Thank you for the help this was starting to get to me that i couldn't get it to work correctly but knew it had to be how i was returning the data or some combination of that and incorrect references to the scripts. Again thank you very much.
So i changed it to the MVC 4 dll and used it in my MVC5 app and get the following. More confused about IgniteUI than before, and really hoping the new documentation is released soon as i have no idea why MVC5 dll throws the undefined function error and the MVC4 throws this error.
Server Error in ‘/’ Application.
Inheritance security rules violated by type: ‘Infragistics.Web.Mvc.GridDataSourceActionAttribute’. Derived types must either match the security accessibility of the base type or be less accessible.
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.TypeLoadException: Inheritance security rules violated by type: ‘Infragistics.Web.Mvc.GridDataSourceActionAttribute’. Derived types must either match the security accessibility of the base type or be less accessible.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[TypeLoadException: Inheritance security rules violated by type: 'Infragistics.Web.Mvc.GridDataSourceActionAttribute'. Derived types must either match the security accessibility of the base type or be less accessible.] System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0 System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +145 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +162 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +87 System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Int32 attributeCtorToken, Boolean mustBeInheritable) +207 System.Reflection.CustomAttribute.IsDefined(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit) +62 System.Reflection.RuntimeMethodInfo.IsDefined(Type attributeType, Boolean inherit) +69 System.Attribute.IsDefined(MemberInfo element, Type attributeType, Boolean inherit) +211 System.Reflection.CustomAttributeExtensions.IsDefined(MemberInfo element, Type attributeType, Boolean inherit) +10 Microsoft.Practices.ObjectBuilder2.<SelectMethods>d__2.MoveNext() +704 Microsoft.Practices.ObjectBuilder2.DynamicMethodCallStrategy.PreBuildUp(IBuilderContext context) +634 Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +274 Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey) +162 Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +245 Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +274 Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +384 [ResolutionFailedException: Resolution of the dependency failed, type = "NOMISe.eSIMON.Web.UI.Areas.Admin.Controllers.UserController", name = "(none)". Exception occurred while: while resolving. Exception is: TypeLoadException - Inheritance security rules violated by type: 'Infragistics.Web.Mvc.GridDataSourceActionAttribute'. Derived types must either match the security accessibility of the base type or be less accessible. ----------------------------------------------- At the time of the exception, the container was: Resolving NOMISe.eSIMON.Web.UI.Areas.Admin.Controllers.UserController,(none) ] Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +447 Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides) +50 Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) +48 Microsoft.Practices.Unity.UnityContainerExtensions.Resolve(IUnityContainer container, Type t, ResolverOverride[] overrides) +61 Unity.Mvc5.UnityDependencyResolver.GetService(Type serviceType) +140 System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +87 [InvalidOperationException: An error occurred when trying to create a controller of type 'NOMISe.eSIMON.Web.UI.Areas.Admin.Controllers.UserController'. Make sure that the controller has a parameterless public constructor.] System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +247 System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +438 System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +257 System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +326 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +157 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +88 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +50 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Yeah i forgot to add more data about version etc i am using. I am using MVC 5/EF6.1.1/jquery 2.1.1/ jqueryui 1.10.4. I can try and use the MVC 4 dll instead of the MVC 5 dll and see if it works which would then indicate that there is an issue with the MVC 5 dll
So i verified all my css/js files are in the correct location. I added the loader() to my _layout.cshtml file so that it will dynamically load for the whole site but i am still getting undefined function error. Is there a better way to be setting up the grid or is this an issue with 2014.1?
Do you guys have a Nuget package for licensed copies? I only ask because having a nuget we could install would eliminate some of the issues of having to make sure we have everything manually installed and that it would put things in the proper locations from install.
Still throwing the error. I am also using a local copy verse the cdn but i am not sure if that has any play on it either. In my layout i call the loader.js, i did see that you call @(Html.Infragistics.loader()) is that also needed? If so i will have to get that added to the page also will have to make sure all the css needed is added to the project.