MVC Wrappers : Foreign Key Column With Nullable Int Shows Blank Cells

4 posts, 0 answers
  1. Evan
    Evan avatar
    14 posts
    Member since:
    Oct 2012

    Posted 20 Apr 2015 Link to this post

    I still struggle continually with this issue.  If I use a nullable int on my model and use .ForeignKeyFor in my .cshtml, then when I select the first item in the list, it goes blank. I've added .ValuePrimitive(true) to my GridForeignKey.cshtml editor template, but this is still a problem.  Also, I think it's not unreasonable to expect if you add a row to the grid that it would default the value to null and let you select the first item in the list.  I don't think anything I've tried has let me do this.  The best I've been able to do is create an actual item for null with a value of 0 or something and then code it on the server side to treat 0 as null.  I don't feel like this is a great solution.  Anyone had better luck that me?  Telerik do you have a recommendation or an example?

  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2831 posts

    Posted 23 Apr 2015 Link to this post

    Hi,

    Please accept my apologies for the delayed response.
    This problem appears to be fixed in the internal builds. Can you please try upgrading to see if this helps?

    You can also set an option label if you want to be able to select null value after editing:
    Html.Kendo().DropDownListFor(m => m)    
        .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
        .OptionLabel(" ")
        .ValuePrimitive(true)


    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Casey
    Casey avatar
    3 posts
    Member since:
    Jul 2012

    Posted 10 Mar 2016 in reply to Evan Link to this post

    I have the same issue. I wish they would resolve this.
  4. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3747 posts

    Posted 15 Mar 2016 Link to this post

    Hello Casey,

    Could you upgrade to the latest internal build of Kendo UI / UI for ASP.NET MVC?

    If the problem still persists, please send us a repro demo that demonstrates the issue.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top