display html on web page

  • Thread starter Thread starter Guoqi Zheng
  • Start date Start date
G

Guoqi Zheng

Probably very simple question since I am new in Dot Net....

I have a DisplayHtml function in moudle1.vb which is:

Function DisplayHtml(ByRef fstrText As String)

' replace line break with <br> in html

fstrText = Replace(fstrText, Chr(10), "<br>")

'fstrText = Replace(fstrText, Chr(13), "<br>")

Return fstrText

End Function


I have the following on apsx page...

<%# DisplayHtml(DataBinder.Eval(Container.DataItem, "Content"))%>


Of course you know what I want to do... I want to change link break to Html
code < br>.

However, I met an error of "Compiler Error Message: BC30451: Name
'DisplayHtml' is not declared."

Where can I look for the error? What did I do wrong???


--
Kind regards

Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.com
 
Hello Guoqi,
However, I met an error of "Compiler Error Message: BC30451: Name
'DisplayHtml' is not declared."

Is DisplayHtml defined in the ASPX's code-behind? An ASPX page generates a subclass of your code-behind class and if the method isnt available there, that would lead to your error.
 
It could be the accessibility of the function (though I don't know VB.NET so
well, especially how the accessibility defaults).
The function must be accessible to the aspx page, which is inherited from
the aspx.vb codebehind class. I presume it defaults to private, and it needs
to be at least protected.

Pete Beech
 
What do you mean by code-behind... DisplayHtml function is available on
Mudule... I didn't put anything on .aspx.vb file... What should I put
there???


--
Kind regards

Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.com

Matt Berther said:
Hello Guoqi,


Is DisplayHtml defined in the ASPX's code-behind? An ASPX page generates a
subclass of your code-behind class and if the method isnt available there,
that would lead to your error.
 
Hello Guoqi,
What do you mean by code-behind... DisplayHtml function is available
on Mudule... I didn't put anything on .aspx.vb file... What should I
put there???

Put your DisplayHtml method in the .aspx.vb file.
 
Specifically make it public, i had the same problem till I did that. Not
sure why, but it seemed to work for me.

HTH,
Sueffel
 
Back
Top