473,480 Members | 4,939 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DataBinder.Eval(Container.Item, "myDownloadFile") Question

Hey

Okay using DataBinder.Eval in a repeater.

My question is this - if the value is empy, eg the myDownloadFile is empty,
how can i display different output than if it was populated.

# pretend code
<% if DataBinder.Eval(Container.Item, "myDownloadFile) == String.Empty) { %>
Now download file is available
<% } else { %>
Click here to download <%# DataBinder.Eval(Container.Item, "myDownloadFile")
%>
<% } %>

How can i achieve this ? i believe i could use a terniary but thats well
nasty :)

<%# DataBinder.Eval(Container.Item, 'Example') != String.Empty ? "download
bleh" : "no download" %>

You help is must appreciated :)
Thanks
Chris
Nov 18 '05 #1
1 1751
Hi, Chri

Databinding on aspx page cannot contain complicated logic
You can achieve that in the Repeater's ItemDataBound Event
void R1_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
if (e.Item.DataItem("myDownloadFile") == String.Empty)
((Label)e.Item.FindControl("myDownloadFile")).Text = "No download file available"
}

Nov 18 '05 #2

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

Similar topics

1
1021
by: Chris | last post by:
Hey - sorry for the double post - but i'm really stuck and needing to fix this quicksmart. Okay using DataBinder.Eval in a repeater. My question is this - if the Container.Item value is empy,...
0
7040
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,...
1
6736
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
5331
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,...
1
4772
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...
0
2994
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...
0
2980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1299
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 ...
1
561
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.