Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Help!! i'm stuck in a big way

Reply
Thread Tools

Help!! i'm stuck in a big way

 
 
Chris
Guest
Posts: n/a
 
      05-28-2004
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, eg 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


 
Reply With Quote
 
 
 
 
Jeffrey Palermo [MCP]
Guest
Posts: n/a
 
      05-28-2004
Chris,
I would solve this problem by wrapping the DataBinder.Eval call in a
method that returns a string. Define this method in your page code.
<%#MyMethod(DataBinder.Eval(Container.Item, "myDownloadFile"))%>

public string MyMethod(string myVar){
if(myVar == string.Empty){
return "No download file is available.";
}else{
return "Click here to download . . .";
}
}

Best Regards,
Jeffrey Palermo

"Chris" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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, eg

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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net 0 12-26-2008 09:29 AM
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net Web Controls 0 12-26-2008 06:11 AM
GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf Python 0 12-24-2008 07:35 AM
GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf Ruby 0 12-24-2008 05:07 AM
Big JARs = Big Problems? kk_oop@yahoo.com Java 11 09-18-2005 05:54 PM



Advertisments