-2

i would like to create custom html controls or form control. I can not find tutorial for it. I would like to create new controls or override existing form control. For example - override button and add icon into button.

Thanks

bluray
  • 1,875
  • 5
  • 36
  • 68
  • Possible duplicate of [How to create an Image button in MVC 4](http://stackoverflow.com/questions/17610391/how-to-create-an-image-button-in-mvc-4) – NightOwl888 Jun 07 '16 at 04:29

1 Answers1

0

It is not the solution to my problem. I dont want write this:

@using (Html.BeginForm("ActionTaken", "TestController"))   {
  <button name="button" value="ActionOne" class="button" style="width: 200px;">
     <img src=""/></button>
  <button name="button" class="button" style="width: 160px;" value="ActionTwo">
  <img src=""/></button>             }

But I want to write something like:

@Html.ButtonWithImage()

Of course i can create HtmlHelper extension, but my question was whether it is done button class, something like:

class MyButton : Control{
  public string Icon{get; set;}    
  public void Render()
  {
  }
}

or better still to be MyButton child of Html Button. I would expand on it icon and override render method...

bluray
  • 1,875
  • 5
  • 36
  • 68