473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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!
Nov 19 '05 #1
3 1845
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!

Nov 19 '05 #2
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" <No************@comcast.netNoSpamM> wrote
in message news:6E**********************************@microsof t.com...
| 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!
| >
Nov 19 '05 #3
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!
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Michelle Keys | last post by:
Subject: DataBinder.Eval Error! Server Error in '/MSPOS' Application. ------------------------------------------------------------------------ -------- DataBinder.Eval:...
2
by: dm_dal | last post by:
I have a control on my webform that I am binding to a dataset. The issue is, the field value in the dataset is encrypted and I am trying to decrypt it during the binding process: Example: ...
5
by: bg | last post by:
Hi! How do I check if "date" exists before using that code? I've built a RSSreader and sometimes there's a date in it and sometimes not. How can I check if it exists to avoid crash...
4
by: Søren Lund | last post by:
Hello, I am trying to bind a DataGrid with some data from a DataSet which contains fields in the form "group.fieldname". I am certain that my data source contains the field but I cannot get my...
1
by: Mike Lerch | last post by:
Pretty much, TSIA, but I'll expand a bit: I'm still trying to get my head around the n-tier approach to web design. It seems to me that when you use DataBinder.Eval in the ASPX that your tiers...
2
by: jack | last post by:
Hello, I have a date in a SQL Database and want to use the dateformat tools to format the output. I am now using the Month, Day, and Year to do it now. I want to change: Released Date:...
3
by: Eric Newton | last post by:
Given databinding an array of System.Version types: Given that "SomeObject" type has a Version property: public class SomeObject { public Version Version { get; } public string Description {...
1
by: Nathan Sokalski | last post by:
I want to make an email link using databinding. I am able to get and display the email address from the database it is stored in using databinding as follows: <asp:HyperLink id="lnkEmail1"...
4
by: CharlesA | last post by:
a general question... I'm a bit mystified by Databinder.eval(object, Colname, ) if controls can be bound to their individual data sources within the load event of the page... why would we ever...
1
by: RobASPNewGuy | last post by:
Hi, I'm new to this forum and hope I can get some help. I would like to make life easier by combining a appSetting (global variable set in the web.config file) and DataBinder.Eval to create a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.