3.5 ListView - How do I do conditional logic the right way?

Discussion in 'ASP .Net' started by mikebrengartner, Feb 27, 2008.

  1. Hi all,
    I've got a data bound list view that I'm trying to work with. I'm
    trying to fill out the item template with a table row that displays a
    link to a file if the job status is complete. I've found that using
    Eval won't work, since it is only applicable to databound items, not
    for conditional logic.

    What's the right way to do this? My guess is that I need to trap an
    event off the listview and do it as it builds, but the obvious choices
    don't seem to be appropriate.

    Any thoughts?

    Thanks in advance,
    Mike
     
    mikebrengartner, Feb 27, 2008
    #1
    1. Advertisements

  2. Something like this:

    if (Eval("Status") == "Complete")
    {
    <a href="sompath.file">File Name</a>
    }
    else
    leave blank
     
    mikebrengartner, Feb 28, 2008
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.