티스토리 뷰
Class 방식
using System.Web.Mvc;
namespace WebApplication.Helpers
{
public static class HelperClass
{
public static string ExtensionMethod(this HtmlHelper helper)
{
return "call ExtensionMethod";
}
}
}
@using WebApplication.Helpers
@Html.ExtensionMethod()
참조(web.config 파일에 네임스페이스 등록시 @using WebApplication.Helpers 선언 없이 사용가능 )
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="WebApplication.Helpers" />
</namespaces>
</pages>
</system.web.webPages.razor>
Inline 방식
@helper ExtensionMethodInineType(string message)
{
@message
}
@ExtensionMethodInineType("call ExtensionMethodInineType")
App_Code 방식
App_Code 폴더 추가
@HelpersFromAppCode.AppCodeHelper("call App_Code helper")
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- FileUpload
- hyper-v
- await
- App Store
- System.Diagnostics
- .submit()
- 문자 자르기
- 명령어
- async
- 아이폰
- 공백제거
- 앱 스토어
- html tag
- 제품 등록
- 상품 등록
- In App Purchase
- trim
- system.io
- 특정 문자를 기준으로 자르기
- Task
- MainActor
- 진수 변환
- mssql
- nl2br
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함