Dynamically Generating Delete Button

M

Matt

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
 
B

Bruno Alexandre

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

Matt

Thanks



Bruno said:
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"
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top