[FIXED] [2.3] GridPanelFor throws exception when [Column(Width = 30)] specified in model

  1. #1

    [FIXED] [2.3] GridPanelFor throws exception when [Column(Width = 30)] specified in model

    When I specify a column width on my model and then use the GridPanelFor helper for the model I get an exception.

    Specs:
    Ext.Net.Utilities 2.2.0.0 (Nuget package 2.2.1)
    Ext.Net 2.2.0.41185 (Nuget Ext.Net MVC package 2.2.0)
    .NET 4.5
    MVC 4
    Razor 2

    Code:
    Model
       public class Ticket
        {
    
            [Column(Order = 1, Width = 30)]
            public string Number { get; set; }
    
            [Column(Order = 2)]
            public string Status { get; set; }
    
            [Column(Order = 3, Flex = 1)]
            public string Subject { get; set; }
    
            [Column(Order = 4)]
            [Required(ErrorMessage = "Area is required")]
            [Display(Name = "Area")]
            public string Area { get; set; }
    }
    View
    @model List<Ticket>
    
    @(Html.X().Window()
        .ID("Tickets")
        .Closable(true)
        .Resizable(true)
        .Icon(Icon.PageCopy)
        .Title("My Tickets")
        .Draggable(true)
        .Width(500)
        .Height(300)
        .Modal(false)
        .Minimizable(true)
        .Maximizable(true)
        .Layout(LayoutType.Form)
        .Items(
            Html.X().GridPanelFor(Model)
                .ID("ticketList")
        )
    )
    Controller
        public class SupportController : Controller
        {
    
            public Ext.Net.MVC.PartialViewResult Tickets()
            {
                List<Ticket> tickets = new List<Ticket>();
                Ticket ticket = new Ticket();
                ticket.Number = "1";
                ticket.Status = "Open";
                ticket.Subject = "Bug Fix";
                ticket.Area = "Website";
    
                tickets.Add(ticket);
                tickets.Add(ticket);
                return new Ext.Net.MVC.PartialViewResult() { ViewName = "Tickets", Model = tickets };
            }
        }
    Exception:
    Object of type 'System.Int32' cannot be converted to type 'System.Web.UI.WebControls.Unit'.
    System.ArgumentException: Object of type 'System.Int32' cannot be converted to type 'System.Web.UI.WebControls.Unit'.
    [No relevant source lines]
    [ArgumentException: Object of type 'System.Int32' cannot be converted to type 'System.Web.UI.WebControls.Unit'.]
    System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) +185
    System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) +122
    System.Reflection.RuntimeMethodInfo.InvokeArgument sCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +206
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +126
    System.Reflection.RuntimePropertyInfo.SetValue(Obj ect obj, Object value, Object[] index) +43
    Ext.Net.Utilities.ObjectUtils.Apply(Object to, Object from, Boolean ignoreDefaultValues) +350
    Ext.Net.MVC.ColumnBaseAttribute.OnMetadataCreated( ModelMetadata metadata) +422
    System.Web.Mvc.AssociatedMetadataProvider.ApplyMet adataAwareAttributes(IEnumerable`1 attributes, ModelMetadata result) +106
    System.Web.Mvc.AssociatedMetadataProvider.GetMetad ataForProperty(Func`1 modelAccessor, Type containerType, PropertyDescriptor propertyDescriptor) +159
    System.Web.Mvc.<GetMetadataForPropertiesImpl>d__2. MoveNext() +412
    System.Linq.Buffer`1..ctor(IEnumerable`1 source) +520
    System.Linq.<GetEnumerator>d__0.MoveNext() +252
    Ext.Net.Store.InitByType(Type type, Boolean extractGeneric) +2504
    Ext.Net.Store.InitByObject(Object obj) +414
    Ext.Net.BuilderFactory`1.StoreFor(IEnumerable data, Boolean modelOnly) +177
    Ext.Net.BuilderFactory`1.GridPanelFor(IEnumerable data, Boolean modelOnly, Boolean buildStore, Boolean createColumns) +134
    Systems.Support.Views.Support.Tickets.Execute() +2042
    ASP._Page_Views_Support_Tickets_cshtml.Execute() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Te mporary ASP.NET Files\root\3f64b63a\6fd5952e\App_Web_tickets.cshtm l.a54a78af.naobmmjo.0.cs:0
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy() +280
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
    System.Web.WebPages.WebPageBase.ExecutePageHierarc hy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
    Ext.Net.MVC.PartialViewResult.RenderRazorView(Cont rollerContext context, RazorView razorView) +288
    Ext.Net.MVC.PartialViewResult.ExecuteResult(Contro llerContext context) +672
    System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionRe sultWithFilters>b__17() +33
    System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854172
    System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
    System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInv okeAction>b__22(IAsyncResult asyncResult) +838644
    System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCo re>b__18(IAsyncResult asyncResult) +28
    System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidD elegate>b__3(IAsyncResult ar) +15
    System.Web.Mvc.Controller.EndExecuteCore(IAsyncRes ult asyncResult) +65
    System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidD elegate>b__3(IAsyncResult ar) +15
    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
    System.Web.Mvc.<>c__DisplayClass8.<BeginProcessReq uest>b__3(IAsyncResult asyncResult) +42
    System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidD elegate>b__3(IAsyncResult ar) +15
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsync Result asyncResult) +51
    System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +606
    System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +288
    Last edited by Daniil; Aug 02, 2013 at 2:40 PM. Reason: [FIXED] [2.3]
  2. #2
    Hello!

    Thank you! We investigating.
  3. #3
    Thanks for the report, fixed in SVN. The fix will be availble in the next release
    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. Replies: 6
    Last Post: Mar 12, 2013, 7:29 PM
  2. [2.1] GridPanelFor Editor field related to model
    By millenovanta in forum 2.x Help
    Replies: 2
    Last Post: Nov 30, 2012, 4:34 PM
  3. Replies: 4
    Last Post: Mar 09, 2012, 7:28 PM
  4. Replies: 2
    Last Post: Jan 13, 2012, 5:12 AM
  5. Paging and Sorting Example throws exception
    By Skorfulose in forum 1.x Help
    Replies: 1
    Last Post: Nov 19, 2009, 4:30 AM

Tags for this Thread

Posting Permissions