views:

72

answers:

1

Hi,

i need to create a HtmlHelperExtension in VB instead of C#. I cannot find any example showing how it's done. Since static classes don't exist in VB (modules are used instead), I'm not really sure on how to create a HtmlHelperExtension...

This is what I figured out, but it doesn't seem to work...

Public Module HtmlHelperExtensions
    Public Function PartnumberLink(ByVal HtmlHelper As HtmlHelper, ByVal LinkText As String, ByVal Partnumber As String) As String
        Return "<a href=""/part/" & Partnumber & """>" & LinkText & "</a>"
    End Function
End Module
A: 

See this:

Public Module HtmlHelperExtensions
    <Extension()>_
    Public Function PartnumberLink(ByVal HtmlHelper As HtmlHelper, ByVal LinkText As String, ByVal Partnumber As String) As String
        Return "<a href=""/part/" & Partnumber & """>" & LinkText & "</a>"
    End Function
End Module
Anton Gogolev
Thanks, i had a hard time finding the right terms to search...
Ropstah