Click to See Complete Forum and Search --> : Data Grid


kohlimannu
August 20th, 2005, 07:04 AM
HI

I need a grid which is having coloums on top and left side also.
like a cross tab grid

is this possible dot net

jhammer
August 22nd, 2005, 03:56 AM
Yes, you have two options:
1. DataGrid: If you want the user to be able to add/delete/edit all the fields. You can customize its appearance to your needs.
2. ListView: If you want fancy looking list, but the user can only do little editing.

kohlimannu
August 22nd, 2005, 04:39 AM
Yes, you have two options:
1. DataGrid: If you want the user to be able to add/delete/edit all the fields. You can customize its appearance to your needs.
2. ListView: If you want fancy looking list, but the user can only do little editing.

i need a row heading as we have column heading please tell me how to do that.

jhammer
August 22nd, 2005, 05:36 AM
What exactly do you need in this "Row Heading"? Number? Words?What is the length of the heading?

kohlimannu
August 22nd, 2005, 06:03 AM
please see the attached file its a jpg file you can get the view as what i want the grid to look like.

torrud
August 22nd, 2005, 08:21 AM
The solution is simple. Take the System.Windows.Forms.DataGrid class and you have the grid and all you need. After that you can use DataGridTableStyles and DataGridColumnStyles for customizing the look.

kohlimannu
August 23rd, 2005, 12:59 AM
Hi torrud

pls give me some code for that coz i was looking on the net but not find useful code.
or may be i m lil confused regarding this.

jhammer
August 23rd, 2005, 01:57 AM
For start, I suggest you drag a DataGrid to the form. Then Right-Click on it, and select AutoFormat. Choose something, and see that the appearance of the grid changed. You can check the properties of the DataGrid, to see all the color properties and play with it.
The DataGrid has a TableStyles property. You can click on it, and press Add. You will see there is ColumnStyles property. The MappingName is the name of the field in the table datasource. You can play with the background color, and set it to gray.
After you press ok, you can switch to Code View, go to the InitializeComponents method and see how this is done in code.

This would be a good start.

kohlimannu
August 23rd, 2005, 04:06 AM
For start, I suggest you drag a DataGrid to the form. Then Right-Click on it, and select AutoFormat. Choose something, and see that the appearance of the grid changed. You can check the properties of the DataGrid, to see all the color properties and play with it.
The DataGrid has a TableStyles property. You can click on it, and press Add. You will see there is ColumnStyles property. The MappingName is the name of the field in the table datasource. You can play with the background color, and set it to gray.
After you press ok, you can switch to Code View, go to the InitializeComponents method and see how this is done in code.

This would be a good start.


i got some idea but still confuse how to change the text of RowHeader

jhammer
August 23rd, 2005, 08:55 AM
The text in RowHeader should be the first column in the grid. The table you are showing will have a column "RowHeader" for example, and each row will be assign with its appropriate row header. This will be shown in the first column of the grid (By setting the ColumnStyles)