Problem: "Does not exist in current context"

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hey

asp.net 2.0 (C'#)

In the code behind file I have this method:
public String AddBR(Object param) {
String text = (String) param;
return text;
}

(( I know this method does nothing, but when I've fixed the compile error
then I will add more code to this method ))

Here I'm using this AddBR method to set the text property of a TextBox:
Text='<%# AddBR(eval(question)) %>'

ERROR:
When I build my website I get this error:
"The name 'eval' does not exist in the current context"

What am I doing wrong here?

Jeff
 
I dont understand why you're using eval here. Since, question is a
variable you can directly pass it on as a parameter. It should work.

Let me know, if i understood the problem wrongly.
 
Sorry I forgot 2 " (added " arround the question)
Text='<%# AddBR(eval("question")) %>'
I also tried this:
Text='<%# AddBR(Bind("question")) %>'
but result in this error: The name 'Bindl' does not exist in the current
context"

This code does not work, it just sends the string "question" to the AddBR
method
Text='<%# AddBR("question") %>'
(I thought this was using the AddBR method directly)

I have not solved this problem yet!

Any suggestions?

The "question" represent a column in the resultset. So I'm interested in
sending this value to the AddBR method. Lets say this "question" column has
the value "How do you do?".. Then I want this "How do you do?" to be sent
into the AddBR method.

the purpose of this AddBR method is that I want to replace linefeeds in the
string with <br/> - text formating
 
Back
Top