Skip to content
infront webworks logo
  • Home
  • Digital Marketing
        • Digital Marketing

        • SEO
          • Enterprise SEO and Digital Marketing
          • Local SEO
          • SEO Audit
          • SEO Consulting
          • SEO Services
          • SEO Tools
          • SEO Workshops
          • Small Business SEO
          • White Label SEO
        • SEM | Search Engine Marketing | PPC
          • Ads & PPC
          • Advertising Management
          • Content Marketing Strategy
          • Conversion Rate Optimization
          • Reputation Management
        • Social Media Marketing
          • Facebook
          • Instagram
          • LinkedIn
          • Pinterest
          • Twitter
        • Need A Website or Seo Help?

          Request a Quote or (719) 577-4404

  • Websites
        • Websites

        • Web Development
          • Business Websites
          • Custom Web Applications
          • Small Business Websites
          • Sitefinity CMS
          • Website Costs
          • Website Evaluation
          • WordPress
        • Web Design
          • Ecommerce
          • Mobile First Web Design
          • Site Speed Optimization
        • Cloud Services
          • Domain Registration
          • Web Hosting
          • Website SSL Certified
        • Need A Website or Seo Help?

          Request a Quote or (719) 577-4404

  • About
        • About

        • The Team
        • Why Infront Webworks
        • Jobs
          • SEO Jobs
          • Website Development Jobs
        • Need A Website or Seo Help?

          Request a Quote or (719) 577-4404

  • Case Studies
        • Case Studies

        • SEARCH ENGINE OPTIMIZATION CASE STUDIES
          • Assisted Living SEO
          • Attorney & Law SEO
          • Automotive SEO
          • Criminal Attorney SEO
          • Dentist SEO
          • E-Commerce SEO​
          • Employment/Staffing SEO
          • Finance SEO
          • Hospitality SEO
          • Home Services SEO
          • Manufacturing SEO
          • Medical & Health Care SEO​
          • Non-Profit SEO​
          • Retail SEO
          • Real Estate SEO
          • Religious SEO
          • Travel and Leisure SEO
        • Web Development Case Studies
          • Small Business Web Design
          • Medium Business Web Design
          • WordPress Web Design
          • Church Web Design
          • Large Business Web Design
          • Nonprofit Web Design
        • Need A Website or Seo Help?

          Request a Quote or (719) 577-4404

  • Blog
  • Contact
        • Contact

        • Support
        • Need A Website or Seo Help?

          Request a Quote or (719) 577-4404

        • Sitemap
Request a Quote or (719) 577-4404
Request a Quote or (719) 577-4404

Home > Blog > Web Design > Instructions for Creating a Feather (MVC) widget

Instructions for Creating a Feather (MVC) widget

  • May 24, 2016
  • 8:27 pm
  • By: Steven Yashur

These instructions are for a Feather (MVC) widget, but you’d retrieve the same value if you were using a regular Sitefinity widget. Skip to the code

Let’s suppose, for the sake of illustration, you’ve a dynamic module with a multiple choice field for choosing the color — maybe a hero image that has some text and a “learn more” button over top of it.

modulebuilder (new)

Your fields would be something like this:

  • Related media field called Image
  • Short text field called Headline
  • Short text field called Learn More URL
  • Choices field called Button Color

The client is going to want to make sure that the button color is going to match the background. It would be really difficult to see a light blue button over a picture of a clear blue sky, for example. So it’s important to give the client some button color options that they can select from. One of those options is labeled Dark Blue with a value of dkblue. The plan here is that you are going to get the value from the button color field, because the values of the color selection options correspond to CSS classes for the buttons.

@item.Fields.Color will give you “Dark Blue” which is pretty much useless because you can’t have a CSS class that has two words for its name. But how do you get the selected value, instead of the selected label?

One option would be to use the values as the labels, but if you did that you could end up with a bunch of users who are confused over what the labels stand for. It really would be much better to show the user “Dark blue” while allowing you to get the value “dkblue” instead.

To accomplish that, you just need to get the persisted value of the multiple choice field:

var bgcolor = item.Fields.Color.PersistedValue;
<div class=”card-over @bgcolor”>

About the Author

Loading...
Steven Yashur Technical Director
Steven Yashur
Senior Web Developer

Steve is Infront’s longest-serving employee and has over twenty years of experience in System Administration and Network Administration. For the last seventeen years, he’s worked in web application development focused on ASP, Ruby on Rails, .NET and Javascript as well as RDBMS (Microsoft SQL Server, Postgres and MySQL).

Infront Webworks Contact Form

START THE CONVERSATION

Service Interests
This field is hidden when viewing the form
This field is for validation purposes and should be left unchanged.
Talk with a local rep: Boulder SEO | Colorado Springs SEO | Denver SEO | Irvine SEO | Las Vegas SEO | Madison SEO | Tempe SEO

Infront Webworks

5350 Tomah Dr #2800
Colorado Springs, CO 80918


Follow Us

Facebook-f Twitter Instagram Linkedin Youtube Rss

HAVE QUESTIONS OR NEED HELP?

SALES: (719) 577-4404 SUPPORT: (719) 359-5540 BILLING: (719) 577-4404 FAX: (719) 630-7073
Open a Support Ticket
© Infront Webworks 2022

Terms of Service | Privacy Policy | Jobs | Company | The Team | HTML Sitemap | XML Sitemap