Monday, December 15, 2014

Editor Template for Boolean Property in Razor

If you want to display 2 radio buttons for a boolean property in Razor with Yes and No labels, this is how you could do it.

Create your own editor template and put it in the Shared/EditorTemplate folder.

Template code:

@model bool
@using System.Web.Mvc
@Html.RadioButtonFor(model=>model, false) No
@Html.RadioButtonFor(model => model, true) Yes

16 comments:

  1. Thanks to share this programming language courses and important information like this.

    hadoop training

    ReplyDelete
  2. Wonderful article, very useful and well explanation. Thanks a lot for offering this unique post with us. I really enjoyed by reading your blog post.

    Hadoop Training in Chennai

    ReplyDelete
  3. Great post! I am see the programming coding and step by step execute the outputs.I am gather this coding more information. It's helpful for me my friend. Also great blog here with all of the valuable information you have.
    PTE Coaching in Chennai


    ReplyDelete
  4. There are many interesting information included and i can easily understand all given information.I post something on my blog to post something, or wait to post something worth saying. Keep update more information....
    Best Interior Designers in Chennai
    Interior Designers in Chennai

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing....
    Click here:
    python training in marathahalli
    Click here:
    python training in btm

    ReplyDelete
  7. Your very own commitment to getting the message throughout came to be rather powerful and have consistently enabled employees just like me to arrive at their desired goals.
    Blueprism training in Chennai

    Blueprism training in Bangalore

    Blueprism training in Pune

    ReplyDelete
  8. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Devops Training in Chennai
    Devops Training in Bangalore

    ReplyDelete
  9. This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.. 

    best rpa training in chennai |
    rpa training in chennai |
    rpa training in bangalore
    rpa training in pune | rpa online training

    ReplyDelete
  10. Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.
    java training in chennai | java training in bangalore

    java interview questions and answers | core java interview questions and answers

    ReplyDelete
  11. Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
    Microsoft Azure online training
    Selenium online training
    Java online training
    Python online training
    uipath online training

    ReplyDelete


  12. better to visit this site rather than any other it will be better oracle training in chennai

    ReplyDelete