469,645 Members | 1,971 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

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

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
Nov 18 '05 #1
2 1600
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

"Gary" wrote:
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

Nov 18 '05 #2
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
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Marios Koumides | last post: by
9 posts views Thread by Pam Ammond | last post: by
3 posts views Thread by Tracey | last post: by
8 posts views Thread by ameen.abdullah | last post: by
18 posts views Thread by ~john | last post: by
6 posts views Thread by rn5a | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.