Datagrid ButtonColumn only visible when criteria met?

J

John Mason

Hi,

I have a datagrid of invoices with a buttoncolumn that users can click
on to pay a particular invoice. Once the invoice is paid, the datagrid
is reloaded, however, the button to pay the invoice still appears
alongside the paid invoice.

During the payment process I set a SQL 'bit' column to 1, signifying the
invoice has been paid.

Does anyone know how I can display all invoices in the datarid, but set
buttoncolumn visibilty to false, for all paid invoices? I would like
'Paid' to appear instead of the button.

Thanks in advance,

John.
 
E

Eliyahu Goldin

John,

Consider using a TemplateColumn instead of a ButtonColumn. Put in the item
template a button "Pay" and a label "Paid". Databind the Visible property
for the button and for the label to the column that tells you if the invoice
has been paid. Alternatively you can handle ItemDataBound event and the
Visible programmatically.

Eliyahu
 

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

Top