How can I disable a Delete button Based on Condition

P

Paul D. Fox

I have a Datagrid displaying "Start Date" and "End Date" with a Delete
Button. I want to disable the Delete Button if the Start Date is less than
current date. I believe you do this in the "DataGrid1_ItemDataBound" but
not sure what to code here.

Paul
 
B

Brock Allen

In the ItemDataBound use FindControl("TheIDOfTheButton") to get access the
the Control. Once you have the control, you can set the Enabled property.
You'll have to call FindControl on the DataGridItemEventArgs.Item, which
is the row in the DataGrid that was just DataBound.
 
J

John

Hey I'm having a similar problem. I need to deactivate a control on my
datagrid based on the results of an sql query. i cant figure out a a good
place or way to loop through the results of the query and disable the
control. there are 3 kinds of PINs bieng boudn to the data grid.
Deactivated Masters, Deactivated sub pins with active masters and deactivated
subs without active masters. i need to be able to look through the lists of
pins and determine what catagory they fall into(i have a sql statement for
this) and if i find an deactivated sub with a deactivated master i want to
disable the activate button so we dont activate a pin that we cant see or
use(beacuse the managemnt grid is controlled by master pins). any help
would be appreciated. the only place i can think of is to use an
OnItemDataBound method but that seems like it could take awhile and i'm not
sure how to step through the information in my SqlDataReader to test for my
cases
 

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,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top