I tried to use a mix of what i found online and your sample on the IgniteUI page and the default app in VS2012 and the code generated from the mvc helper is saying undefined is not a function. Here is the code i have on the index and what the controller is doing.
@(Html.Infragistics()
.Grid<NOMISe.eSIMON.Web.UI.Areas.Admin.Models.UserIndexView.UserIndexViewEntity>() .ID("userGrid") .Columns(column => { column.For(x => x.ID).HeaderText("ID").DataType("string").Hidden(true); column.For(x => x.DisplayName).HeaderText("Full Name").DataType("string").Width("20%"); column.For(x => x.Email).HeaderText("Email").DataType("string").Width("20%"); column.For(x => x.Status).HeaderText("Status").DataType("int").Width("10%"); column.For(x => x.Department).HeaderText("Department").DataType("string").Width("25%"); column.For(x => x.ExpirationDate).HeaderText("Expiration Date").DataType("dateLong").Width("25%"); }) .Width("100%") .Height("600px") .PrimaryKey("ID") .DataBind() .Render())
the controller:
[PermissionAttribute(Core.Security.SecurityMask.View)] public ActionResult Index() { UserIndexView viewModel = new UserIndexView();
IEnumerable<UserIndexView.UserIndexViewEntity> userList = from user in userService.All() select new UserIndexView.UserIndexViewEntity { ID = user.ID, DisplayName = user.DisplayName, Email = user.Email, Status = user.Status, Department = user.Department, ExpirationDate = user.ExpirationDate };
viewModel.UserIndexViewEntitys = userList;
return View(viewModel); }
Hello ekolluri ,
Thank you for posting in our forum.
I see you’re returning the data that the grid should use in the Action, however it doesn’t seem like the grid is using that data.
You should either see the model to be used by the grid:
@(Html.Infragistics().Grid<NOMISe.eSIMON.Web.UI.Areas.Admin.Models.UserIndexView.UserIndexViewEntity>(Model. UserIndexViewEntitys)
Or set the DataSource or DataSourceURL options since otherwise the grid will have no data source to bind to.
I’ve attached an example of how the grid can be bound via the Model.
Please refer to the attached sample and let me know if you have any questions.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://ko.infragistics.com/support
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?
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.
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
Thank you for the additional information.
The issue you’re getting is due to using the MVC4 assembly instead of the MVC 5 one. This issue has previously been discussed here:
http://ko.infragistics.com/community/forums/t/84498.aspx
I’ve tested how the MVC 5 assembly of version 14.1.20141.2031(latest version at the moment) behaves in an MVC 5 application with the following versions of jquery and jquery ui:
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.20/jquery-ui.js"></script>
When a remote data source url is set. However it works as expected when testing this on my side.
I’ve attached the MVC 5 application for your reference. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using version version 14.1 service release version: 14.1.20141.2031.
If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if I can provide any further assistance.
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.
Hello ekolluri,
I’m glad to hear you have resolved the issue.
If you have any additional questions or concerns don’t hesitate to let me know.
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);
Partial view:
@using Infragistics.Web.Mvc;
@model IEnumerable
@(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.