473,378 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 1648
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
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
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
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
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
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
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
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
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
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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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 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.