Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - DataBinder.Eval()

 
Thread Tools Search this Thread
Old 03-11-2005, 02:47 PM   #1
Default DataBinder.Eval()


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
  Reply With Quote
Old 03-11-2005, 03:03 PM   #2
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBNVlA=?=
 
Posts: n/a
Default RE: DataBinder.Eval()
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=?=
  Reply With Quote
Old 03-11-2005, 04:58 PM   #3
bruce barker
 
Posts: n/a
Default Re: DataBinder.Eval()
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
  Reply With Quote
Old 03-12-2005, 02:36 PM   #4
Patrick Olurotimi Ige
 
Posts: n/a
Default Re: DataBinder.Eval()
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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46