changing display of the datagrid cell value

H

harry

Hi all,

I have a datagrid (language C#) populated using a stored procedure. I
want one of the column to display complete name instead of
abbreviation. Can I change the display dynamically in the datagrid or
should I change it in stored procedure?
 
S

Simon Tamman

Well... in terms of abstraction I would leave the grid to worry about
displaying the "display" value as UI concerns in the data layer are always a
little minging.

To answer the problem it depends if you are talking about the column header
(which I believe you are), if so, check out the DataGridTableStyle class you
can create one and bung it in the DataGrid.TableStyles collection, with this
you can add DataGridTextBoxColumns (or BoolColumns) which have a
..MappingName and HeaderText property, which map to the data value (e.g the
value in your stored proc) and display in the UI respectively.
The style has a mapping name too which will probably be the table name in
your case but is the name of the collection type if binding collections.

To edit a specific value of a cell in a grid requires: DataGrid[0,0] = "I'm
the first cell".
 
H

harry

Thank You


Simon said:
Well... in terms of abstraction I would leave the grid to worry about
displaying the "display" value as UI concerns in the data layer are always a
little minging.

To answer the problem it depends if you are talking about the column header
(which I believe you are), if so, check out the DataGridTableStyle class you
can create one and bung it in the DataGrid.TableStyles collection, with this
you can add DataGridTextBoxColumns (or BoolColumns) which have a
.MappingName and HeaderText property, which map to the data value (e.g the
value in your stored proc) and display in the UI respectively.
The style has a mapping name too which will probably be the table name in
your case but is the name of the collection type if binding collections.

To edit a specific value of a cell in a grid requires: DataGrid[0,0] = "I'm
the first cell".

harry said:
Hi all,

I have a datagrid (language C#) populated using a stored procedure. I
want one of the column to display complete name instead of
abbreviation. Can I change the display dynamically in the datagrid or
should I change it in stored procedure?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top