Dynamically Generating Delete Button

Discussion in 'ASP .Net' started by Matt, Oct 12, 2006.

  1. Matt

    Matt Guest

    I am trying to build a Datagrid whoose edit column contains an edit and
    delte image button. However I want to be able to determine via another
    column whether or not the delete button should be presented or not.

    I have a column called "Submitted" and if that column = "Yes" then they
    CAN NOT delete the row, otherwise they can.

    I need to somehow do an if statement or something that will allow me to
    only show the delete button some of the time.

    I know I cannot do an IF loop within my <%# %> block or atleast I
    cannot figure out how to.

    I tried creating a function within the <%# %> but I cannot figure out
    how to pass the "DataGridCommandEventArgs" into the function which I
    would need to determine which row I am in.


    Any help much aprreciated.

    Thanks
    Matt
     
    Matt, Oct 12, 2006
    #1
    1. Advertisements

  2. just use the Visible property of the delete button

    ....Visible='<%# Eval("canDelete") %>'

    if canDelete = true then the button will be visible, if not, then the button
    will be invisible :)

    hope it helps

    --

    Bruno Alexandre
    København, Danmark

    "a portuguese in Denmark"
     
    Bruno Alexandre, Oct 12, 2006
    #2
    1. Advertisements

  3. Matt

    Matt Guest

    Thanks



     
    Matt, Oct 12, 2006
    #3
    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.