![]() |
|
|
|
#1 |
|
Does this work in C# too?
<%# SomeFunc(DataBinder.Eval(Containter.DataItem, "ColName")%> *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Patrick Olurotimi Ige |
|
|
|
|
#2 |
|
Posts: n/a
|
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")%> > > > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! > =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBNVlA=?= |
|
|
|
#3 |
|
Posts: n/a
|
thats not quite correct.
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) "Cowboy (Gregory A. Beamer) - MVP" <> wrote in message news:6E64B13D-3D6A-4D00-822F-... | 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")%> | > | > | > | > *** Sent via Developersdex http://www.developersdex.com *** | > Don't just participate in USENET...get rewarded for it! | > bruce barker |
|
|
|
#4 |
|
Posts: n/a
|
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? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Patrick Olurotimi Ige |
|