keyongtech


  keyongtech > dotnet.framework.* > dotnet.framework.windowsforms > 02/2004

 #1  
02-11-04, 08:08 PM
a
Is it possible to make some DataGrid's column editable, while some others
not editable? Thanks.
 #2  
02-11-04, 08:36 PM
jim
you can accomplish this using the DataGrid.TableStyles.ColumnStyles
collection. You can manage each individual column's width.

I believe there's also a way to do this directly in the underlying
datasource, but that method escapes me at the moment.

I believe you can control table
"a" <a> wrote in message
news:3012
[..]
 #3  
02-11-04, 09:39 PM
a
Maybe the DataSource is the right solution. For now, I created a new class
DataGridReadOnlyTextBoxColumn inheriting from DataGridTextBoxColumn and
overrode Edit method to just return.

I can't set the width to zero, because I still want to display the columns.

Thanks.


"jim" <james_matthews_at_shi_dotcom> wrote in message
news:3648
[..]
 #4  
02-11-04, 09:45 PM
Tim Wilson
What about setting the DataGridTextBoxColumn.ReadOnly property to True?
 #5  
02-11-04, 10:03 PM
jim
actually, yup. sorry about that. i got lost in thinking about something else
while answering this post and ended up providing an incorrect answer
(sorry!). I was thinking about how to set the width of a datagrid column to
0...

tim's answer is the best method that i know of.

"Tim Wilson" <Tim_Wilson> wrote in message
news:3420
[..]
 #6  
02-11-04, 10:40 PM
a
Oh my, how did that escape me? :) Thanks guys.


"jim" <james_matthews_at_shi_dotcom> wrote in message
news:2764
[..]
 #7  
02-11-04, 11:12 PM
Rob Oldfield
I had a very similar situation. I just used the readonly property and that
worked fine.... but.... the users were very happy when I also figured out
how to display any data in the 'writeable' columns in a different colour (I
used red... readonly data black). Just an idea... I'll try to dig out some
code tomorrow.


"a" <a> wrote in message news:ps13
[..]
 #8  
02-12-04, 02:54 AM
a
That's very interesting, and probably something I'll have to do some day
(change background color). Now, I don't believe there is a property for the
background color, right? :)


"Rob Oldfield" <rob@oldfield100_wow_freeserve_yikes_co_incredible !_uk> wrote
in message news:a632
[..]
 #9  
02-13-04, 07:26 PM
Rob Oldfield
http://www.syncfusion.com/FAQ/WinFor....asp?print=745

I changed it a touch so that I could pass the colours when calling the
class... other than that it pretty much worked right out of the box for me.


"a" <a> wrote in message news:ps13
[..]
Similar Threads
DataGrid EditItemCommand : must click twice to make DataGrid Editable

Hey- I am having trouble with a simple datagrid example, and need some advice if anyone is knowledgable. It's really driving me batty! I've searched newsgroups and help...

editable columns in a datagrid

hi, i'm sort of a newbie in .net and i'm currently doing my major project. i would like to know if it is possible to have a datagrid that would not be having a database as...

How to convert editable word doc to editable html in a browser?

I want to use a browser to edit my current (very large) document. It is formatted using a word template. I can convert to html, but the edit capable fields are no longer open...

Making ONLY 2 columns editable in a datagrid

Hi, I have 2 questions: 1. I have an editable data grid with 21 columns. I need to edit only 2 cloumns in this data grid. But when the grid is displayed in Edit mode,...

how to configure a DataGrid so that only some columns are editable in Edit mode

I have been following the MSDN walkthrough "Using a DataGrid Web Control to Read and Write Data" in order to display an editable DataGrid. This has been working great - I am...


All times are GMT. The time now is 01:44 PM. | Privacy Policy