Datagrid ButtonColumn only visible when criteria met?

  • Thread starter Thread starter John Mason
  • Start date Start date
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.
 
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
 
Back
Top