473,388 Members | 1,408 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,388 software developers and data experts.

How to prevent DataGrid cell editing ?

I have a DataGrid on my Form, and I wish to disable any cell editing.
For example; when the user clicks on a cell, the cell become editable by
changing its color to gray and context menu is shown on muse right mouse
click.
I do not want the enable this cell context menu (I have my own context menu)
and I do not want the cell to change it's color. I want that on any click -
the entire row will be selected.
There are some other cases where the cell become editable, and I want to
prevent them all.
I did not find any event that I can hook to for that.

Can any guru in here tell how to prevent any kind of cell editing in the
DataGrid?
-------
Thanks
Sharon
Mar 9 '06 #1
5 4405
Hi Sharon,

I think most of your problems could be resolved by George Shepherd's
Windows Forms FAQ:
http://www.syncfusion.com/FAQ/Window.../FAQ_c44c.aspx

The corresponding items is as the following ones:

5.7 How do I prevent a click into the grid highlighting a cell?

5.11 How can I select the entire row when the user clicks on a cell in the
row?

5.18 How can I prevent a particular cell from being editable?

5.41 How can I make my grid never have an active edit cell and always
select whole rows (as in a browser-type grid)?

5.87 How can I prevent all the cells in my DataGrid from being edited
without deriving GridColumnStyle?
Thanks!

Best regards,

Gary Chang
Microsoft Community Support
================================================== ====
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006. Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
================================================== ====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Mar 10 '06 #2
Thanks Gary for your replay,
I setting my dataGrid with the dataSet by:
m_DataSet = new myDataSet();// myDataSet is created by a XSD schema.
DataTable defectsTable = m_DataSet.Tables["Defects"]
myDataGrid.DataSource = new DataView(defectsTable);

All my cells are not editable, but in same cases the TexBox cells get in
edit mode while the text can not be changed, but the cell become gray and a
default context menu is shown overriding my own.

For the Windows Forms FAQ:
5.7 - Not good for me because then the user can do nothing with the grid.
5.11 - Doing that.
5.18 - Done that, not solving my problem,.
5.41 - Like 5.18, not solving my problem.
5.87 - Why should I do that?! and in my case the rows are added on runtime
so this function will have to used at any row adding. I did it but the
Control.Count is always 2 and this 2 are the scrollbars.

I'll be very happy if you have any more suggestions.
-------
Thanks
Sharon
Mar 12 '06 #3
Hi Sharon,
All my cells are not editable, but in same cases the
edit mode while the text can not be changed, but the
cell become gray and a default context menu is shown
overriding my own.

For the Windows Forms FAQ:
5.7 - Not good for me because then the user can do
nothing with the grid.


Since the highlightening of the selected cell is a built-in feature of the
standard Winform datagrid control, I am afraid I don't have another idea
than the above one

Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
================================================== ====
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006. Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
================================================== ====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Mar 14 '06 #4
Hi Gary,

If the highlighting of the selected cell is a built-in feature of the
standard Winform datagrid control, maybe I can drived from this control and
do something about it by overriding some functionally.

Maybe you have any suggestion in that direction ?

highlighting

------
Thanks
Sharon
Mar 15 '06 #5
Hi Sharon,
If the highlighting of the selected cell is a built-in feature
of the standard Winform datagrid control, maybe I can
drived from this control and do something about it by
overriding some functionally.


If you would like to implement your own custom datagrid control, I suggest
you consult it in a more appropriate managed newgroup, you'd get better and
quicker help there:

microsoft.public.dotnet.framework.windowsforms.con trols
Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
================================================== ====
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006. Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
================================================== ====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Mar 16 '06 #6

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

Similar topics

3
by: Dmitry Akselrod | last post by:
Hi, I am using a standard .NET 1.0 Datagrid. Actually, I am using two, bound to a master-detail relationship. Both DataGrids are bound to a datasource. I have the MSDN version of the...
11
by: Junkguy | last post by:
I need some help programmatically causing a row in a DataGrid to "flush" its contents to its bound data (in Visual Studio 6 using Windows Forms with C#). My issue is I want to send an update to...
3
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
4
by: TT (Tom Tempelaere) | last post by:
Hi, Suppose there is a DataGrid on a form bound to a DataTable. When a user is editing a cell without leaving the cell, and then closes the form, the value is not updated to the underlying data...
4
by: Suzanne | last post by:
Hi all, I'm having problems with datagrids and the currentcellchanged event. My problem is this: I have a datagrid on a form, if the user changes the text in a cell on the datagrid then tries to...
0
by: Grant Smith | last post by:
I've been creating my own datagrid control which I'm inheiriting from the standard datagrid control and I have come across two very interesting behaviors with the datagrid control. 1. If you...
2
by: Sharon | last post by:
I want put into my DataGrid different control types in the same column. For example: Column 1, row 0 ==> TextBox Column 1, row 2 ==> CheckBox Column 1, row 2 ==> ComboBox etc... As I see, I...
2
by: jock1up | last post by:
I am working with editing within a DataGrid control cell and am confused about which events occur after the editing is completed. I see that 5 events can occur total, including the ones below and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.