Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Disabling text boxes within a data grid whilst in edit mode.

Reply
Thread Tools

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

 
 
=?Utf-8?B?R2FyeQ==?=
Guest
Posts: n/a
 
      10-28-2004
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TmVpbA==?=
Guest
Posts: n/a
 
      10-28-2004
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

 
Reply With Quote
 
 
 
 
Wasi Rehman
Guest
Posts: n/a
 
      10-29-2004
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop through all text boxes a column in a grid staeri@gmail.com Javascript 2 02-17-2006 12:15 PM
Snapshot restraint - edit, edit, edit Alan Browne Digital Photography 24 05-10-2005 10:15 PM
Snapshot restraint - edit, edit, edit Patrick Digital Photography 0 05-06-2005 10:53 PM
How to edit records in a grid that's within a grid Iams ASP .Net Datagrid Control 0 03-17-2005 06:41 PM
Is it possible to set the size of text boxes in edit mode ? Ing. Rajesh Kumar ASP .Net 2 05-22-2004 06:42 PM



Advertisments