Filtering Nullable Guid Column in Grid Causes Exception

2 posts, 0 answers
  1. John
    John avatar
    18 posts
    Member since:
    Apr 2015

    Posted 28 Oct Link to this post

    I have a nullable Guid column in my grid that is using an editor template to display a the text value associated with the Guid in the lookup table.

    columns.ForeignKey(p => p.NotAcceptableReason, (System.Collections.IEnumerable)ViewBag.NotAcceptableReasons, "NotAcceptableReasonId", "NotAcceptableReasonName").Width(200);

     

    The editor template:

    @using Kendo.Mvc.UI
    @model object
     
    @(
     Html.Kendo().DropDownListFor(m => m)
            .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
            .OptionLabel("--- Select ---")
            .ValuePrimitive(true)
    )

     

    On that column's column filter popup,I get all the text values from the lookup table in a drop down list and the filtering work as expected.

    However, when I try to filter the column on "Is null" or "Is not null" I get an error -> System.FormatException: Unrecognized Guid format.

    I suspect this is because there is no NULL entry in the lookup table I'm binding the drop down list to.  Any suggestions for getting the "Is null" or "Is not null" column filters to work correctly in this scenario?

     

  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 01 Nov Link to this post

    Hi John,

    I wasn't able to reproduce the mentioned issue with this online demo - http://demos.telerik.com/aspnet-mvc/grid/foreignkeycolumn. Could you please try to reproduce the problem with this demo and then send it back to us for further investigation?

    You can try to download the offline demos in order to use the data source or bind some dummy to the grid. Another approach to reproduce the issue is to download some of our mvc examples (e.g., this one -  grid-foreign-key-combo-box-column)

    Regards,
    Danail Vasilev
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top