473,770 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("DataField Name").

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 1680
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(Contai ner.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******** ********@TK2MSF TNGP06.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("DataField Name").

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************ @5nerrawgenospa m.comwrote in message
news:cB******** ****@bignews1.b ellsouth.net...
>
"Rick Mavrovik" <ri***********@ ricki.comwrote in message
news:%2******** ********@TK2MSF TNGP06.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("DataFiel dName").

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
21923
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 worth the $25USD. I'm just looking for a book on Pointers, because from what I've read it's one of the toughest topics to understand. thanks in advanced.
19
2629
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 information, etc... (Not database applications.) Thanks.
2
2311
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 date can be chosen. This replicates the date-picker control except that it has other checks in it (my user control also has the ability for other data types with other "popups" for validation).... The problem is that if the user control is at...
7
1511
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 Windows Control (though, not a form) into a web page for IE. I was wondering if there's been any talk of the existance of .Net Applets or if that's something that's even been considered. Thanks for any information! Brian
3
11370
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
2607
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 elements/attributes etc. defined but the values in these elements/attributes might be blank or incorrect, as two examples below: <?xml version="1.0" encoding="UTF-8"?> <fileType1> <element1> <element2 attr2="xxx"> <element3>
2
2578
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 elements/attributes etc. defined but the values in these elements/attributes might be blank or place holders, as two examples below: Example - File type 1
0
2700
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 not. First Function Function try1 SET objShell = CreateObject("Wscript.Shell")
4
1696
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
9617
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.