0

I'm working on modifying the CSS of a Select Tag. The Select tag is generated using @Html.DropDownListFor Helper. To change the CSS of the arrow of the select element i need to have a label before or a div incapsulating the select to play with the :before :after. I don't want my developpers to write this on every dropdown.

How can i modify the html response of the helper before sending it the view to add a label for example.

Thanks

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
tahtoh
  • 102
  • 8
  • 2
    What you're looking to build is called a "custom HTML helper". There are plenty of examples you can find on Google to get you started. For example: https://learn.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/views/creating-custom-html-helpers-cs – David Jan 29 '19 at 16:48
  • @David Actually i already know about custom ones, i want to override the main function to keep it's normal validations, intercept the result, and do my modification on it to not break the main behavior. – tahtoh Jan 29 '19 at 16:54
  • @tahtoh Provide your `@Html.DropDownListFor` code in the question. – TanvirArjel Jan 30 '19 at 03:02
  • Its the System.Web.Mvc code built in @TanvirArjel – tahtoh Jan 30 '19 at 14:41

0 Answers0