473,491 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Add a calulated column to a Datagrid

GML
I have a bound datagrid in C# based on an an SQL query.
The results are displayed in a Sharepoint 2003 Webpart.
I would like to add a new column based on the results of two
columns in the datagrid.
It is not possible for me to do this within the SQL query as
the data provider I am using does not support column alias's.

e.g. Put the results of these columns into a new column.

newColumn = new BoundColumn();
newColumn.DataField = "pt_desc1";
newColumn.HeaderText = "Description";
OrdersGrid.Columns.Add(newColumn);

newColumn = new BoundColumn();
newColumn.DataField = "pt_desc2";
newColumn.HeaderText = "Description";
OrdersGrid.Columns.Add(newColumn);
--
GML
Nov 16 '05 #1
10 1651
You can use the DataColumn.Expression property to add a calculated
property to the DataGrid.

For eg. you can use
DataColumn resultColumn = new DataColumn();
resultColumn.Expression = "pt_dec1+pt_desc2";

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

GML wrote:
I have a bound datagrid in C# based on an an SQL query.
The results are displayed in a Sharepoint 2003 Webpart.
I would like to add a new column based on the results of two
columns in the datagrid.
It is not possible for me to do this within the SQL query as
the data provider I am using does not support column alias's.

e.g. Put the results of these columns into a new column.

newColumn = new BoundColumn();
newColumn.DataField = "pt_desc1";
newColumn.HeaderText = "Description";
OrdersGrid.Columns.Add(newColumn);

newColumn = new BoundColumn();
newColumn.DataField = "pt_desc2";
newColumn.HeaderText = "Description";
OrdersGrid.Columns.Add(newColumn);

Nov 16 '05 #2
In addition, there is a good topic on DataColumn.Expression in .net help
files.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Sijin Joseph" <si***************@hotmail.com> wrote in message
news:un**************@TK2MSFTNGP10.phx.gbl...
You can use the DataColumn.Expression property to add a calculated
property to the DataGrid.

For eg. you can use
DataColumn resultColumn = new DataColumn();
resultColumn.Expression = "pt_dec1+pt_desc2";

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

GML wrote:
I have a bound datagrid in C# based on an an SQL query.
The results are displayed in a Sharepoint 2003 Webpart.
I would like to add a new column based on the results of two
columns in the datagrid.
It is not possible for me to do this within the SQL query as
the data provider I am using does not support column alias's.

e.g. Put the results of these columns into a new column.

newColumn = new BoundColumn();
newColumn.DataField = "pt_desc1";
newColumn.HeaderText = "Description";
OrdersGrid.Columns.Add(newColumn);

newColumn = new BoundColumn();
newColumn.DataField = "pt_desc2";
newColumn.HeaderText = "Description";
OrdersGrid.Columns.Add(newColumn);


Nov 16 '05 #3
You should add the column to datasource, in your case to DataTable.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"GML" <GM*@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
Hi Sijin,

Thanks for that but how do i add the new colum to my grid.

I get an error if i use :-
DataColumn resultColumn = new DataColumn();
resultColumn.Expression = "pt_dec1+pt_desc2";
resultColumn.ColumnName = "Part Description";
OrdersGrid.Columns.Add(resultColumn);
"Sijin Joseph" wrote:
You can use the DataColumn.Expression property to add a calculated
property to the DataGrid.

For eg. you can use
DataColumn resultColumn = new DataColumn();
resultColumn.Expression = "pt_dec1+pt_desc2";

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

GML wrote:
> I have a bound datagrid in C# based on an an SQL query.
> The results are displayed in a Sharepoint 2003 Webpart.
> I would like to add a new column based on the results of two
> columns in the datagrid.
> It is not possible for me to do this within the SQL query as
> the data provider I am using does not support column alias's.
>
> e.g. Put the results of these columns into a new column.
>
> newColumn = new BoundColumn();
> newColumn.DataField = "pt_desc1";
> newColumn.HeaderText = "Description";
> OrdersGrid.Columns.Add(newColumn);
>
> newColumn = new BoundColumn();
> newColumn.DataField = "pt_desc2";
> newColumn.HeaderText = "Description";
> OrdersGrid.Columns.Add(newColumn);
>
>

Nov 16 '05 #4
GML
Hi Miha,
Sorry but I'm very new to this can you give me an example?

"Miha Markic [MVP C#]" wrote:
You should add the column to datasource, in your case to DataTable.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"GML" <GM*@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
Hi Sijin,

Thanks for that but how do i add the new colum to my grid.

I get an error if i use :-
DataColumn resultColumn = new DataColumn();
resultColumn.Expression = "pt_dec1+pt_desc2";
resultColumn.ColumnName = "Part Description";
OrdersGrid.Columns.Add(resultColumn);
"Sijin Joseph" wrote:
You can use the DataColumn.Expression property to add a calculated
property to the DataGrid.

For eg. you can use
DataColumn resultColumn = new DataColumn();
resultColumn.Expression = "pt_dec1+pt_desc2";

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

GML wrote:
> I have a bound datagrid in C# based on an an SQL query.
> The results are displayed in a Sharepoint 2003 Webpart.
> I would like to add a new column based on the results of two
> columns in the datagrid.
> It is not possible for me to do this within the SQL query as
> the data provider I am using does not support column alias's.
>
> e.g. Put the results of these columns into a new column.
>
> newColumn = new BoundColumn();
> newColumn.DataField = "pt_desc1";
> newColumn.HeaderText = "Description";
> OrdersGrid.Columns.Add(newColumn);
>
> newColumn = new BoundColumn();
> newColumn.DataField = "pt_desc2";
> newColumn.HeaderText = "Description";
> OrdersGrid.Columns.Add(newColumn);
>
>


Nov 16 '05 #5
Hi,

If I understood your example properly, you were adding a columng to
DataGrid.
Instead, you should be adding a column to the datatable you are using as a
datasource for grid.
I guess somewhere you have something like:
OrdersGrid.Datasource = myDataset;
OrdersGrid.DataMember = "myTableName";

If this is so, then you should do something like:
myDataSet.Tables["myTableName"].Columns.Add(...)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"GML" <GM*@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
Hi Miha,
Sorry but I'm very new to this can you give me an example?

"Miha Markic [MVP C#]" wrote:
You should add the column to datasource, in your case to DataTable.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"GML" <GM*@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
> Hi Sijin,
>
> Thanks for that but how do i add the new colum to my grid.
>
> I get an error if i use :-
>
>
> DataColumn resultColumn = new DataColumn();
> resultColumn.Expression = "pt_dec1+pt_desc2";
> resultColumn.ColumnName = "Part Description";
> OrdersGrid.Columns.Add(resultColumn);
>
>
> "Sijin Joseph" wrote:
>
>> You can use the DataColumn.Expression property to add a calculated
>> property to the DataGrid.
>>
>> For eg. you can use
>> DataColumn resultColumn = new DataColumn();
>> resultColumn.Expression = "pt_dec1+pt_desc2";
>>
>> Sijin Joseph
>> http://www.indiangeek.net
>> http://weblogs.asp.net/sjoseph
>>
>>
>>
>> GML wrote:
>> > I have a bound datagrid in C# based on an an SQL query.
>> > The results are displayed in a Sharepoint 2003 Webpart.
>> > I would like to add a new column based on the results of two
>> > columns in the datagrid.
>> > It is not possible for me to do this within the SQL query as
>> > the data provider I am using does not support column alias's.
>> >
>> > e.g. Put the results of these columns into a new column.
>> >
>> > newColumn = new BoundColumn();
>> > newColumn.DataField = "pt_desc1";
>> > newColumn.HeaderText = "Description";
>> > OrdersGrid.Columns.Add(newColumn);
>> >
>> > newColumn = new BoundColumn();
>> > newColumn.DataField = "pt_desc2";
>> > newColumn.HeaderText = "Description";
>> > OrdersGrid.Columns.Add(newColumn);
>> >
>> >
>>


Nov 16 '05 #6
GML
Hi Miha,

This is what I do :-

OdbcCommand Mfgcmd = new OdbcCommand(MfgSQLString , Mfgconn);
OdbcDataReader Mfgreader = Mfgcmd.ExecuteReader();

OrdersGrid.Enabled = true;
OrdersGrid.DataSource = Mfgreader;
OrdersGrid.DataBind();

George

"Miha Markic [MVP C#]" wrote:
Hi,

If I understood your example properly, you were adding a columng to
DataGrid.
Instead, you should be adding a column to the datatable you are using as a
datasource for grid.
I guess somewhere you have something like:
OrdersGrid.Datasource = myDataset;
OrdersGrid.DataMember = "myTableName";

If this is so, then you should do something like:
myDataSet.Tables["myTableName"].Columns.Add(...)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"GML" <GM*@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
Hi Miha,
Sorry but I'm very new to this can you give me an example?

"Miha Markic [MVP C#]" wrote:
You should add the column to datasource, in your case to DataTable.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"GML" <GM*@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
> Hi Sijin,
>
> Thanks for that but how do i add the new colum to my grid.
>
> I get an error if i use :-
>
>
> DataColumn resultColumn = new DataColumn();
> resultColumn.Expression = "pt_dec1+pt_desc2";
> resultColumn.ColumnName = "Part Description";
> OrdersGrid.Columns.Add(resultColumn);
>
>
> "Sijin Joseph" wrote:
>
>> You can use the DataColumn.Expression property to add a calculated
>> property to the DataGrid.
>>
>> For eg. you can use
>> DataColumn resultColumn = new DataColumn();
>> resultColumn.Expression = "pt_dec1+pt_desc2";
>>
>> Sijin Joseph
>> http://www.indiangeek.net
>> http://weblogs.asp.net/sjoseph
>>
>>
>>
>> GML wrote:
>> > I have a bound datagrid in C# based on an an SQL query.
>> > The results are displayed in a Sharepoint 2003 Webpart.
>> > I would like to add a new column based on the results of two
>> > columns in the datagrid.
>> > It is not possible for me to do this within the SQL query as
>> > the data provider I am using does not support column alias's.
>> >
>> > e.g. Put the results of these columns into a new column.
>> >
>> > newColumn = new BoundColumn();
>> > newColumn.DataField = "pt_desc1";
>> > newColumn.HeaderText = "Description";
>> > OrdersGrid.Columns.Add(newColumn);
>> >
>> > newColumn = new BoundColumn();
>> > newColumn.DataField = "pt_desc2";
>> > newColumn.HeaderText = "Description";
>> > OrdersGrid.Columns.Add(newColumn);
>> >
>> >
>>


Nov 16 '05 #7
Hi GML,

Aaaa, asp.net application.
I guess you could add your "calculated column expression" to sql select
statement - it would be the easiest way.
like: select qty, price, qty*price as amount ...
Is this feasible for you?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
"GML" <GM*@discussions.microsoft.com> wrote in message
news:7C**********************************@microsof t.com...
Hi Miha,

This is what I do :-

OdbcCommand Mfgcmd = new OdbcCommand(MfgSQLString , Mfgconn);
OdbcDataReader Mfgreader = Mfgcmd.ExecuteReader();

OrdersGrid.Enabled = true;
OrdersGrid.DataSource = Mfgreader;
OrdersGrid.DataBind();

George

"Miha Markic [MVP C#]" wrote:
Hi,

If I understood your example properly, you were adding a columng to
DataGrid.
Instead, you should be adding a column to the datatable you are using as
a
datasource for grid.
I guess somewhere you have something like:
OrdersGrid.Datasource = myDataset;
OrdersGrid.DataMember = "myTableName";

If this is so, then you should do something like:
myDataSet.Tables["myTableName"].Columns.Add(...)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"GML" <GM*@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
> Hi Miha,
> Sorry but I'm very new to this can you give me an example?
>
> "Miha Markic [MVP C#]" wrote:
>
>> You should add the column to datasource, in your case to DataTable.
>>
>> --
>> Miha Markic [MVP C#] - RightHand .NET consulting & development
>> miha at rthand com
>> www.rthand.com
>>
>> "GML" <GM*@discussions.microsoft.com> wrote in message
>> news:50**********************************@microsof t.com...
>> > Hi Sijin,
>> >
>> > Thanks for that but how do i add the new colum to my grid.
>> >
>> > I get an error if i use :-
>> >
>> >
>> > DataColumn resultColumn = new DataColumn();
>> > resultColumn.Expression = "pt_dec1+pt_desc2";
>> > resultColumn.ColumnName = "Part Description";
>> > OrdersGrid.Columns.Add(resultColumn);
>> >
>> >
>> > "Sijin Joseph" wrote:
>> >
>> >> You can use the DataColumn.Expression property to add a calculated
>> >> property to the DataGrid.
>> >>
>> >> For eg. you can use
>> >> DataColumn resultColumn = new DataColumn();
>> >> resultColumn.Expression = "pt_dec1+pt_desc2";
>> >>
>> >> Sijin Joseph
>> >> http://www.indiangeek.net
>> >> http://weblogs.asp.net/sjoseph
>> >>
>> >>
>> >>
>> >> GML wrote:
>> >> > I have a bound datagrid in C# based on an an SQL query.
>> >> > The results are displayed in a Sharepoint 2003 Webpart.
>> >> > I would like to add a new column based on the results of two
>> >> > columns in the datagrid.
>> >> > It is not possible for me to do this within the SQL query as
>> >> > the data provider I am using does not support column alias's.
>> >> >
>> >> > e.g. Put the results of these columns into a new column.
>> >> >
>> >> > newColumn = new BoundColumn();
>> >> > newColumn.DataField = "pt_desc1";
>> >> > newColumn.HeaderText = "Description";
>> >> > OrdersGrid.Columns.Add(newColumn);
>> >> >
>> >> > newColumn = new BoundColumn();
>> >> > newColumn.DataField = "pt_desc2";
>> >> > newColumn.HeaderText = "Description";
>> >> > OrdersGrid.Columns.Add(newColumn);
>> >> >
>> >> >
>> >>
>>
>>
>>


Nov 16 '05 #8
GML
Hi Miha,
Thanks for you help so far much appreciated.

No it's not I'm afraid. I'm using an Openlink provider which does not
support alias columns in the SQL select statement.

George

"Miha Markic [MVP C#]" wrote:
Hi GML,

Aaaa, asp.net application.
I guess you could add your "calculated column expression" to sql select
statement - it would be the easiest way.
like: select qty, price, qty*price as amount ...
Is this feasible for you?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
"GML" <GM*@discussions.microsoft.com> wrote in message
news:7C**********************************@microsof t.com...
Hi Miha,

This is what I do :-

OdbcCommand Mfgcmd = new OdbcCommand(MfgSQLString , Mfgconn);
OdbcDataReader Mfgreader = Mfgcmd.ExecuteReader();

OrdersGrid.Enabled = true;
OrdersGrid.DataSource = Mfgreader;
OrdersGrid.DataBind();

George

"Miha Markic [MVP C#]" wrote:
Hi,

If I understood your example properly, you were adding a columng to
DataGrid.
Instead, you should be adding a column to the datatable you are using as
a
datasource for grid.
I guess somewhere you have something like:
OrdersGrid.Datasource = myDataset;
OrdersGrid.DataMember = "myTableName";

If this is so, then you should do something like:
myDataSet.Tables["myTableName"].Columns.Add(...)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"GML" <GM*@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
> Hi Miha,
> Sorry but I'm very new to this can you give me an example?
>
> "Miha Markic [MVP C#]" wrote:
>
>> You should add the column to datasource, in your case to DataTable.
>>
>> --
>> Miha Markic [MVP C#] - RightHand .NET consulting & development
>> miha at rthand com
>> www.rthand.com
>>
>> "GML" <GM*@discussions.microsoft.com> wrote in message
>> news:50**********************************@microsof t.com...
>> > Hi Sijin,
>> >
>> > Thanks for that but how do i add the new colum to my grid.
>> >
>> > I get an error if i use :-
>> >
>> >
>> > DataColumn resultColumn = new DataColumn();
>> > resultColumn.Expression = "pt_dec1+pt_desc2";
>> > resultColumn.ColumnName = "Part Description";
>> > OrdersGrid.Columns.Add(resultColumn);
>> >
>> >
>> > "Sijin Joseph" wrote:
>> >
>> >> You can use the DataColumn.Expression property to add a calculated
>> >> property to the DataGrid.
>> >>
>> >> For eg. you can use
>> >> DataColumn resultColumn = new DataColumn();
>> >> resultColumn.Expression = "pt_dec1+pt_desc2";
>> >>
>> >> Sijin Joseph
>> >> http://www.indiangeek.net
>> >> http://weblogs.asp.net/sjoseph
>> >>
>> >>
>> >>
>> >> GML wrote:
>> >> > I have a bound datagrid in C# based on an an SQL query.
>> >> > The results are displayed in a Sharepoint 2003 Webpart.
>> >> > I would like to add a new column based on the results of two
>> >> > columns in the datagrid.
>> >> > It is not possible for me to do this within the SQL query as
>> >> > the data provider I am using does not support column alias's.
>> >> >
>> >> > e.g. Put the results of these columns into a new column.
>> >> >
>> >> > newColumn = new BoundColumn();
>> >> > newColumn.DataField = "pt_desc1";
>> >> > newColumn.HeaderText = "Description";
>> >> > OrdersGrid.Columns.Add(newColumn);
>> >> >
>> >> > newColumn = new BoundColumn();
>> >> > newColumn.DataField = "pt_desc2";
>> >> > newColumn.HeaderText = "Description";
>> >> > OrdersGrid.Columns.Add(newColumn);
>> >> >
>> >> >
>> >>
>>
>>
>>


Nov 16 '05 #9

"GML" <GM*@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
Hi Miha,
Thanks for you help so far much appreciated.

No it's not I'm afraid. I'm using an Openlink provider which does not
support alias columns in the SQL select statement.


Ah. As a workaround, you might fill a DataTable (using OdbcDataAdapter.Fill
method), then add the calculated column as suggested at beginning of the
thread and link the table to grid instead of linking reader.
What do you say?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
Nov 16 '05 #10
Or just create a calculated field within sql statament (as suggested)
without an alias and set the grid's column header directly via:
OrdersGrid.Columns[insert column number].HeaderText.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"GML" <GM*@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
Hi Miha,
Thanks for you help so far much appreciated.

No it's not I'm afraid. I'm using an Openlink provider which does not
support alias columns in the SQL select statement.

George

"Miha Markic [MVP C#]" wrote:
Hi GML,

Aaaa, asp.net application.
I guess you could add your "calculated column expression" to sql select
statement - it would be the easiest way.
like: select qty, price, qty*price as amount ...
Is this feasible for you?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
"GML" <GM*@discussions.microsoft.com> wrote in message
news:7C**********************************@microsof t.com...
> Hi Miha,
>
> This is what I do :-
>
> OdbcCommand Mfgcmd = new OdbcCommand(MfgSQLString , Mfgconn);
> OdbcDataReader Mfgreader = Mfgcmd.ExecuteReader();
>
> OrdersGrid.Enabled = true;
> OrdersGrid.DataSource = Mfgreader;
> OrdersGrid.DataBind();
>
> George
>
> "Miha Markic [MVP C#]" wrote:
>
>> Hi,
>>
>> If I understood your example properly, you were adding a columng to
>> DataGrid.
>> Instead, you should be adding a column to the datatable you are using
>> as
>> a
>> datasource for grid.
>> I guess somewhere you have something like:
>> OrdersGrid.Datasource = myDataset;
>> OrdersGrid.DataMember = "myTableName";
>>
>> If this is so, then you should do something like:
>> myDataSet.Tables["myTableName"].Columns.Add(...)
>>
>> --
>> Miha Markic [MVP C#] - RightHand .NET consulting & development
>> miha at rthand com
>> www.rthand.com
>>
>> "GML" <GM*@discussions.microsoft.com> wrote in message
>> news:7A**********************************@microsof t.com...
>> > Hi Miha,
>> > Sorry but I'm very new to this can you give me an example?
>> >
>> > "Miha Markic [MVP C#]" wrote:
>> >
>> >> You should add the column to datasource, in your case to DataTable.
>> >>
>> >> --
>> >> Miha Markic [MVP C#] - RightHand .NET consulting & development
>> >> miha at rthand com
>> >> www.rthand.com
>> >>
>> >> "GML" <GM*@discussions.microsoft.com> wrote in message
>> >> news:50**********************************@microsof t.com...
>> >> > Hi Sijin,
>> >> >
>> >> > Thanks for that but how do i add the new colum to my grid.
>> >> >
>> >> > I get an error if i use :-
>> >> >
>> >> >
>> >> > DataColumn resultColumn = new DataColumn();
>> >> > resultColumn.Expression = "pt_dec1+pt_desc2";
>> >> > resultColumn.ColumnName = "Part Description";
>> >> > OrdersGrid.Columns.Add(resultColumn);
>> >> >
>> >> >
>> >> > "Sijin Joseph" wrote:
>> >> >
>> >> >> You can use the DataColumn.Expression property to add a
>> >> >> calculated
>> >> >> property to the DataGrid.
>> >> >>
>> >> >> For eg. you can use
>> >> >> DataColumn resultColumn = new DataColumn();
>> >> >> resultColumn.Expression = "pt_dec1+pt_desc2";
>> >> >>
>> >> >> Sijin Joseph
>> >> >> http://www.indiangeek.net
>> >> >> http://weblogs.asp.net/sjoseph
>> >> >>
>> >> >>
>> >> >>
>> >> >> GML wrote:
>> >> >> > I have a bound datagrid in C# based on an an SQL query.
>> >> >> > The results are displayed in a Sharepoint 2003 Webpart.
>> >> >> > I would like to add a new column based on the results of two
>> >> >> > columns in the datagrid.
>> >> >> > It is not possible for me to do this within the SQL query as
>> >> >> > the data provider I am using does not support column alias's.
>> >> >> >
>> >> >> > e.g. Put the results of these columns into a new column.
>> >> >> >
>> >> >> > newColumn = new BoundColumn();
>> >> >> > newColumn.DataField = "pt_desc1";
>> >> >> > newColumn.HeaderText = "Description";
>> >> >> > OrdersGrid.Columns.Add(newColumn);
>> >> >> >
>> >> >> > newColumn = new BoundColumn();
>> >> >> > newColumn.DataField = "pt_desc2";
>> >> >> > newColumn.HeaderText = "Description";
>> >> >> > OrdersGrid.Columns.Add(newColumn);
>> >> >> >
>> >> >> >
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Nov 16 '05 #11

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

Similar topics

3
4838
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...
6
3216
by: Robert Schuldenfrei | last post by:
Dear NG, After being away from C# programming for a spell, I am trying my hand at what should be a simple task. I have been hitting my head against the wall this morning. I have a simple order...
1
2466
by: Drew | last post by:
Hey, thanks in advance for helping me out with my problem: I have a datagrid which is embedded in another datagrid. The datagrid is filled directly by a dataset generated from a sql query. So...
6
2727
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is...
10
4924
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
5
3687
by: Rich | last post by:
I have a datagrid that uses a dataview object for its datasource. The dataview contains a unique row identifier column. I don't want to display this column in the datagrid. I need the unique row...
3
3513
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
10
2320
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option....
4
2895
by: gane | last post by:
Hi, I am creating datagrid bound column dynamically and need to check if a datagrid column already exists?Is there a way to check this? thanks gane
0
7115
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
6978
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...
0
7154
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
7190
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...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7360
tracyyun
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...
0
4578
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1392
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.