SORU
10 Mayıs 2011, Salı


's @yok Html.Düğme !

bu garip. @Html için başvurular görüyorum.Ben bu Intellisense gibi bir yardımcı bulmak değil yazdığınızda() düğmesi ama... dropdownlist, gizli, editörler, vesaire, ama düğmesi yok!

ne oldu o iş?

CEVAP
10 Mayıs 2011, Salı


public static class HtmlButtonExtension 
{

  public static MvcHtmlString Button(this HtmlHelper helper, 
                                     string innerHtml, 
                                     object htmlAttributes) 
  { 
    return Button(helper, innerHtml,
                  HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)
    ); 
  }

  public static MvcHtmlString Button(this HtmlHelper helper, 
                                     string innerHtml,
                                     IDictionary<string, object> htmlAttributes)
  {
      var builder = new TagBuilder("button");
      builder.InnerHtml = innerHtml;
      builder.MergeAttributes(htmlAttributes);
      return MvcHtmlString.Create(builder.ToString());
  }
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Ben Vivona

    Ben Vivona

    24 Ocak 2010
  • Call Me Howard

    Call Me Howa

    18 AĞUSTOS 2012
  • Nickcidious

    Nickcidious

    6 HAZİRAN 2011