473,491 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Prevent edits in one datagrid column

I have a datagrid bound to a datatable with only two columns.
This is a list of properties and their values.
I want the user to be able to perform edits only on the property values
but I don't want them to be able to edit the property names.

I can use the keypress event to cancel the keypress if the
currentcell.columnnumber is 0.
Is there a slicker way to handle this?

Regards,
Erik
Nov 21 '05 #1
3 1049
VJ
Check this site out..

http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp

VJ

"Engineerik" <En********@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com...
I have a datagrid bound to a datatable with only two columns.
This is a list of properties and their values.
I want the user to be able to perform edits only on the property values
but I don't want them to be able to edit the property names.

I can use the keypress event to cancel the keypress if the
currentcell.columnnumber is 0.
Is there a slicker way to handle this?

Regards,
Erik

Nov 21 '05 #2
Hi,

Add a tablestyle to your datagrid. Set the readonly property of the
datagridtextboxcolumn to true for the column you do not want the user to
edit.

Link on how to add a tablestyle to a datagrid

http://msdn.microsoft.com/library/de...asicprimer.asp
Ken
----------------------
"Engineerik" <En********@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com...
I have a datagrid bound to a datatable with only two columns.
This is a list of properties and their values.
I want the user to be able to perform edits only on the property values
but I don't want them to be able to edit the property names.

I can use the keypress event to cancel the keypress if the
currentcell.columnnumber is 0.
Is there a slicker way to handle this?

Regards,
Erik
Nov 21 '05 #3
That is exactly what I was looking for but couldn't find.
Perfect!

Regards,
Erik

"Ken Tucker [MVP]" wrote:
Hi,

Add a tablestyle to your datagrid. Set the readonly property of the
datagridtextboxcolumn to true for the column you do not want the user to
edit.

Link on how to add a tablestyle to a datagrid

http://msdn.microsoft.com/library/de...asicprimer.asp
Ken
----------------------
"Engineerik" <En********@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com...
I have a datagrid bound to a datatable with only two columns.
This is a list of properties and their values.
I want the user to be able to perform edits only on the property values
but I don't want them to be able to edit the property names.

I can use the keypress event to cancel the keypress if the
currentcell.columnnumber is 0.
Is there a slicker way to handle this?

Regards,
Erik

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4838
by: PeterZ | last post by:
Hi, In a running C# app with a datagrid control I select all rows in the dataGrid using CTRL-A, I then paste into some other app like notepad or Word but the column headings get left off. Is...
0
968
by: Jim Heavey | last post by:
Hello, I have a datagrid that I have configured to bind to "table1". I created and "EditItemTemplate" which is also bound to "table1" except for two columns which I bound to "table2" and "table3"...
2
6371
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
4
1780
by: Anthony | last post by:
Hi Folks, I'm adding some columns to my datagrid which are of Combo Box type. I'm inheriting DataGridTextBoxColumn and doing all the usual stuff to get them populated. This is working fine. I...
10
4924
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
3
2275
by: Ryan Liu | last post by:
Can someone give a sample to prevent a row from being deleted in a datatable? I tried e.Row.RejectChanges(); in dt_RowDeleting() but seems does not work. I need verify if there other data...
4
3436
by: Keith G | last post by:
VS2003 I am using a datagrid on a Windows form. The user has 2 buttons: cancel the current changes (re-loads the dataset) or update (updates the dataset). The problem is that any edits in the...
0
984
by: Rod | last post by:
I want to be able to access the text in an edit text box which appears when editting a row in a datagrid Now I know that if you have a button column then you can do it like this. Sub...
2
6556
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
7115
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7154
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7360
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4881
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3086
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1392
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.