on an aspx page any code in <% %> or <%# %> must use the syntax of the
language picked for the page. with c# you must be careful of it stricter
type checking. DataBinder.Eval alway returns a string to make it easier to
use from C#.
-- bruce (sqlwork.com)
in message | ASPX tags are not affected by the language chosen for CodeBehind or server
| side scripting tags.
|
|
| ---
|
| Gregory A. Beamer
| MVP; MCP: +I, SE, SD, DBA
|
| ***************************
| Think Outside the Box!
| ***************************
|
| "Patrick Olurotimi Ige" wrote:
|
| > Does this work in C# too?
| > <%# SomeFunc(DataBinder.Eval(Containter.DataItem, "ColName")%>
| >
| >
| >
| >
| > Don't just participate in USENET...get rewarded for it!
| >
I converted this VB code:-
Protected Function CheckUnit(Units As Object) As String
If Integer.Parse(Units) = 0 Then
Return "No Units"
Else
Return Units.ToString()
End If
End Function
to C#:-
Protected string CheckUnit(Units Object)
If (int.Parse(Units) == 0 ){
return "No units";
}
Else
{
return Units.ToString();
}
}
End Function
Thx Bruce for the response!
And i have noticed C# is much stricter.
In VB.Net i know this works:-
<%# CheckUnit(DataBinder.Eval(Containter.DataItem, "ColName")%>
How would i call "DataBinder.Eval" to get the same result as above using
C#.
Any ideas?
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.