Disabling text boxes within a data grid whilst in edit mode.

G

Guest

Hello All,

I have an editable data grid in my web form, this grid allows the user to
add new records, edit existing records and also delete them. When a user adds
a record the grid goes in to edit mode and four text boxes appear, one is for
the start date, another for an end date and the other two are for other data,
the user fills in the fields and saves the data, all is great at this point,
an entry is added ok. However the problem I am having is when a user edits a
record I do not want the start date and end date text boxes to be editable, I
just want the standard labels to appear and not editable text boxes, but I do
want the other two text boxes to appear.

So, in a nutshell, I want four text boxes to be editable when a recorded is
added, however I want only two text boxes to appear and be editable when a
user updates a record.

Does anyone know how I would achieve this?

Thanks
 
G

Guest

Hi Gary,

The textbox will expose an OnDataBinding event, use this event to check
whether the row is being added or edited and set the enabled property of the
text box appropriately. This should do the trick.

Thanks
N
 
W

Wasi Rehman

Hi Gary,

What you have to do is just change the ReadOnly property of your Dates
columns to False
If your Datagrid's AutoColumn property is true then you have to do it by
Some Coding but if you did manually bind the column through DataGrid
property page then you have to check ReadOnly property of Column.

I think this help you out

Regards,
Wasi Rehman
 

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,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top