By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,483 Members | 3,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,483 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.