Is there a way to programatically set the format of just one column in a
datagrid? I have a datagrid bined to a datasource. My dataview has 6
columns. And I want to format one column ('amount')...without have to mess
with all the other columns.
If I use DataGridTableStyle() and DataGridTextBoxColumn() (see following
code)...my datagrid only displays 1 column!
Dim dvFinders As New DataView(dtFinders)
DataGrid1.DataSource = dvFinders
' set properties
Dim x As New DataGridTableStyle
x.MappingName = "Finders"
Dim z As New DataGridTextBoxColumn
z.MappingName = "lastname"
z.Width = 150
x.GridColumnStyles.Add(z)
DataGrid1.TableStyles.Add(x)
This datagrid is making my project a lot harder than it should be!
Any help is appreciated!
-bruce duncan 5 1707
If you are going to use DataTable for one column, you'll need to add one for
each column you want to display. If you don't want to add a tablestyle for
each column, then add a column to your datatable (dataview has a datatable)
and for the column directly on the datatable.
Chris
"Bruce D" <br*************@hotmail.com> wrote in message
news:11*************@corp.supernews.com... Is there a way to programatically set the format of just one column in a datagrid? I have a datagrid bined to a datasource. My dataview has 6 columns. And I want to format one column ('amount')...without have to mess with all the other columns. If I use DataGridTableStyle() and DataGridTextBoxColumn() (see following code)...my datagrid only displays 1 column!
Dim dvFinders As New DataView(dtFinders) DataGrid1.DataSource = dvFinders ' set properties Dim x As New DataGridTableStyle x.MappingName = "Finders" Dim z As New DataGridTextBoxColumn z.MappingName = "lastname" z.Width = 150 x.GridColumnStyles.Add(z) DataGrid1.TableStyles.Add(x)
This datagrid is making my project a lot harder than it should be!
Any help is appreciated! -bruce duncan
*Corrected wording
If you are going to use DataGridTableStyle for one column, you'll need to
add one for each column you want to display. If you don't want to add a
DataGridTableStyle for each column, then add a column to your datatable
(dataview has a datatable) and for the column directly on the datatable.
Chris
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:%2****************@TK2MSFTNGP15.phx.gbl... If you are going to use DataTable for one column, you'll need to add one for each column you want to display. If you don't want to add a tablestyle for each column, then add a column to your datatable (dataview has a datatable) and for the column directly on the datatable.
Chris
"Bruce D" <br*************@hotmail.com> wrote in message news:11*************@corp.supernews.com... Is there a way to programatically set the format of just one column in a datagrid? I have a datagrid bined to a datasource. My dataview has 6 columns. And I want to format one column ('amount')...without have to mess with all the other columns. If I use DataGridTableStyle() and DataGridTextBoxColumn() (see following code)...my datagrid only displays 1 column!
Dim dvFinders As New DataView(dtFinders) DataGrid1.DataSource = dvFinders ' set properties Dim x As New DataGridTableStyle x.MappingName = "Finders" Dim z As New DataGridTextBoxColumn z.MappingName = "lastname" z.Width = 150 x.GridColumnStyles.Add(z) DataGrid1.TableStyles.Add(x)
This datagrid is making my project a lot harder than it should be!
Any help is appreciated! -bruce duncan
Thanks Chris!
How about another question? I have a DataTable that has both lastname,
firstname as seperate fields. How can I display them as one field in the
datagrid (and yes...I was forced to use DataGridTableStyle for each column)?
TIA
-bruce
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:Ox**************@TK2MSFTNGP15.phx.gbl... *Corrected wording
If you are going to use DataGridTableStyle for one column, you'll need to add one for each column you want to display. If you don't want to add a DataGridTableStyle for each column, then add a column to your datatable (dataview has a datatable) and for the column directly on the datatable.
Chris
I assume you are getting your data out of a database? In that case I would
do it in your select statement.
Select FirstName + ' ' + LastName as Name, TableName.* from TableName
There may be a nice slick way of doing it client side, but this is how I've
always done stuff like that.
Chris
"Bruce D" <br*************@hotmail.com> wrote in message
news:11*************@corp.supernews.com... Thanks Chris! How about another question? I have a DataTable that has both lastname, firstname as seperate fields. How can I display them as one field in the datagrid (and yes...I was forced to use DataGridTableStyle for each column)?
TIA -bruce
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote in message news:Ox**************@TK2MSFTNGP15.phx.gbl... *Corrected wording
If you are going to use DataGridTableStyle for one column, you'll need to add one for each column you want to display. If you don't want to add a DataGridTableStyle for each column, then add a column to your datatable (dataview has a datatable) and for the column directly on the datatable.
Chris
Thanks for the response, but I was looking for the client side answer.
-bruce
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:%2****************@TK2MSFTNGP14.phx.gbl... I assume you are getting your data out of a database? In that case I
would do it in your select statement.
Select FirstName + ' ' + LastName as Name, TableName.* from TableName
There may be a nice slick way of doing it client side, but this is how
I've always done stuff like that. Chris
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brett P. |
last post by:
Hello,
I am trying to have only one column sortable within a
data grid. I know you set the allow sorting property to
true on the style, but this enables sorting for all
columns. Is there a way...
|
by: Terry |
last post by:
Hey,
Having somewhat of an issue, I have a datagrid which is giving me issues.
The Datagrid is setup for the user to double click the row, the row is
selected and data within that row populates a...
|
by: KevLow |
last post by:
Hi,
Hope some kind soul can help me out here..
I'm trying to programmatically modify the column headings of a crosstab
query such that it can be dynamic based on user specified period (Month...
|
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...
|
by: localhost |
last post by:
When I go into Edit mode on a datagrid, I would like to
add a single column to the edited row and display a
hyperlink. If I use the code below, I get a delete
linkbutton in every row, when I only...
|
by: BMeyer |
last post by:
I have been losing my mind trying to parse an XML document (with nested child
elements, not all of which appear in each parent node) into a DataGrid
object. What I want to do is "flatten" the XML...
|
by: mark4asp |
last post by:
This page is currently using a Repeater control to create a table with
6 columns. The first column has 2 ImageButton controls and a common
header.
How can I do this with a DataGrid ? I need...
|
by: miferdin |
last post by:
Hi friends,
1.
I have a datagrid with 5 columns, in this when i click edit in a row, all the columns changes into textbox but what i need is to make only a single column into a text...
|
by: yumbelie |
last post by:
Hi,
I want to set multiple datafields from a dataset to a single boundcolumn in my gridview, but I can't see any easy way to do this since the DataField property of the boundcolumn takes a single...
|
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
|
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...
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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: 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...
| |