display html on web page

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
 
M

Matt Berther

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.
 
P

Pete Beech

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
 
G

Guoqi Zheng

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.
 
M

Matt Berther

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.
 
S

Sueffel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top