473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 1775
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Steve | last post by:
Hi all i am just starting to get back into VB and i need a little help. I am writing a program that asks a user to type in a set of numbers/letters (in this case shipping containers). Once the...
7
by: Marios Koumides | last post by:
I post the same question few days ago but there was a confusion in the answers. Anywayz I am posting again. I have a form with 96 textboxes (8 rows x 12 columns) Now I want in the last row to have...
0
by: Shravan | last post by:
Hi, I saw that in Windows Forms DataGrid with new row creation set to true, if I have added a new row earlier which was empty and deleted the row and shifted the focus to any other control and...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
3
by: Tracey | last post by:
I have some text boxes in the footer of a data grid to allow a user to add a new record. For some reason to get the focus in to the text boxes you can only click on the far left of the box if...
1
by: Antonio | last post by:
Can somebody help me? When a user clicks on the Edit button in a data grid, the record stays in the data grid but text boxes outside the grid are displayed and I would like to have the data from...
8
by: ameen.abdullah | last post by:
Hi Guys, I have a checked list box on my form.. the purpose of this checkbox is to indicate that the option is enabled or disabled.. I just want to ask if there is a way to disable these check...
18
by: ~john | last post by:
Sorry if this is a dumb question buy my CSS is pretty bad... but how do I get text to center vertically within a div tag? Here's my code below... the text is displaying on the far top-right. I...
6
by: rn5a | last post by:
When the EditCommandColumn in a DataGrid is clicked, all the BoundColumns get replaced by TextBoxes so that users can alter the data. By default, the Text in the TextBoxes are left-aligned. Is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.