473,410 Members | 1,946 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,410 software developers and data experts.

using Eval ("ZZZ")

Hi,
I am using repeater bound to a dataset.
Within the repeater I have got ItemTemplate in which I am displaying data by
using
Eval("DataFieldName").

Does anyone know how can I perform any calculation in ItemTemplate on the
bound data..For instance. I need to display an image based on some rule like
if Eval("ThisField") is greater than Eval("ThatField").

Any clue?

-Rick
Jul 3 '07 #1
3 1668
Hi,

in addition to the solutions Milosz gave you, here's a third way: call a
code-behind method on the bound data.

<ItemTemplate>
<asp:Label runat="server" ID="lab"
Text='<%# MyMethod(Container.DataItem) %>'/>
</ItemTemplate>

and in the code behind:

protected string MyMethod (object DataItem)
{
DataRowView dr = DataItem as DataRowView;
if (dr == null)
return "";
return dr["Column1"].ToString() + dr["Column2"].ToString();
}

....or whatever you need to do there. You can also pass additional
parameters.

Roland
Jul 3 '07 #2

"Rick Mavrovik" <ri***********@ricki.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi,
I am using repeater bound to a dataset.
Within the repeater I have got ItemTemplate in which I am displaying data
by using
Eval("DataFieldName").

Does anyone know how can I perform any calculation in ItemTemplate on the
bound data..For instance. I need to display an image based on some rule
like if Eval("ThisField") is greater than Eval("ThatField").

Any clue?

-Rick
One additional solution -- add a column to your data which does the
calculation and then use that field name.

mike
Jul 3 '07 #3
Thanks everyone!

"vMike" <Mi************@5nerrawgenospam.comwrote in message
news:cB************@bignews1.bellsouth.net...
>
"Rick Mavrovik" <ri***********@ricki.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Hi,
I am using repeater bound to a dataset.
Within the repeater I have got ItemTemplate in which I am displaying data
by using
Eval("DataFieldName").

Does anyone know how can I perform any calculation in ItemTemplate on the
bound data..For instance. I need to display an image based on some rule
like if Eval("ThisField") is greater than Eval("ThatField").

Any clue?

-Rick
One additional solution -- add a column to your data which does the
calculation and then use that field name.

mike


Jul 4 '07 #4

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

Similar topics

388
by: maniac | last post by:
Hey guys, I'm new here, just a simple question. I'm learning to Program in C, and I was recommended a book called, "Mastering C Pointers", just asking if any of you have read it, and if it's...
19
by: VB Programmer | last post by:
If I have a VB6 and a VB.NET application, or 2 VB.NET applications what is the best way to "talk" between them? They both run on the same PC. Right now I'm just using text files to share...
2
by: Simon Verona | last post by:
I have a problem, best explained by example. I have a usercontrol which contains a text box and a button. If the button is clicked then the calender control is displayed as a "popup" so that a...
7
by: instruo | last post by:
Hi all, I'm curious if Microsoft has any plans of taking the .Net framework to the web in the same kind of capacity as Java Applets do. I've read that using the <object> tag, one can embed a...
3
by: Rob R. Ainscough | last post by:
I've started getting this error now when I load my solution and do a Build. Rebuild doesn't resolve it. Any suggestions? I suspect one of the hotfixes, but can't confirm. Rob.
1
by: Bilal Bhutta | last post by:
Hello, I'm stuck on this problem for quite some time and hope somebody would be able to guide me. Basically, I need to populate a large number of "template" XML files which have all...
2
by: Bilal | last post by:
Hello, I'm stuck on this problem for quite some time and hope somebody would be able to guide me. Basically, I need to populate a large number of "template" XML files which have all...
0
by: edurran | last post by:
Hi all, I have spent the last three days on this problem. Looked in many forums and not found the answer as yet. Hopefully ye can help. I have two functions. One works fine, the second does...
4
by: OldBirdman | last post by:
I have a table with a field -- Code -- containing the following values: +1233 1233 -1233 w-aaa wcc wcc' wcc k wcc! wcc,
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.