473,503 Members | 4,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Move bound column to right of dynamic column in datagrid?

I have a datatable that I am binding to a C# ASP.NET 1.1 web page datagrid.
I also
want to put an "Edit" column on the datagrid. However, whenever I use the
following code, it puts the Edit column on the left. I cannot figure out
how to get it to the right, as there is no DataGridTableStyle for ASP as
there is for an application.
I am doing the following on page load: (where dgItem is my datagrid):

EditCommandColumn editColumn = new EditCommandColumn();
editColumn.ButtonType = ButtonColumnType.LinkButton;
editColumn.CancelText = "Cancel";
editColumn.EditText = "Edit";
editColumn.HeaderText = "Edit";
editColumn.UpdateText = "Save";

dgItem.DataSource = ReturnsPopulatedDataTable();
dgItem.Columns.AddAt(1, editColumn);
/*also tried dgItem.Columns.AddAt(dgItem.Columns.Count, editColumn); without
success*/
dgItem.DataBind();

The edit column keeps showing up on the far left of the grid. Any ideas how
to get it to be added to the right side of the DataTable, instead?

Any help appreciated.
Thanks,

-John
xposted: microsoft.public.dotnet.framework.aspnet.datagrid 3/24/2005
Nov 19 '05 #1
3 2359
One guess:
are you using datagrid with *create columns automatically at run time
option* chosen? if so it generates those columns at run time after the fixed
columns. so you should disable it and assign columns at design time.

masoud

"John E." <PleaseReply@usenet> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl...
I have a datatable that I am binding to a C# ASP.NET 1.1 web page datagrid. I also
want to put an "Edit" column on the datagrid. However, whenever I use the
following code, it puts the Edit column on the left. I cannot figure out
how to get it to the right, as there is no DataGridTableStyle for ASP as
there is for an application.
I am doing the following on page load: (where dgItem is my datagrid):

EditCommandColumn editColumn = new EditCommandColumn();
editColumn.ButtonType = ButtonColumnType.LinkButton;
editColumn.CancelText = "Cancel";
editColumn.EditText = "Edit";
editColumn.HeaderText = "Edit";
editColumn.UpdateText = "Save";

dgItem.DataSource = ReturnsPopulatedDataTable();
dgItem.Columns.AddAt(1, editColumn);
/*also tried dgItem.Columns.AddAt(dgItem.Columns.Count, editColumn); without success*/
dgItem.DataBind();

The edit column keeps showing up on the far left of the grid. Any ideas how to get it to be added to the right side of the DataTable, instead?

Any help appreciated.
Thanks,

-John
xposted: microsoft.public.dotnet.framework.aspnet.datagrid 3/24/2005

Nov 19 '05 #2
Thanks for the response! Yes, I have it set to create columns at runtime.
Is there a way to put the fixed columns to the right of runtime columns
instead of their default location on the left?

Thanks,
-John
"masoud bayan" <ma**********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
One guess:
are you using datagrid with *create columns automatically at run time
option* chosen? if so it generates those columns at run time after the fixed columns. so you should disable it and assign columns at design time.

masoud

"John E." <PleaseReply@usenet> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl...
I have a datatable that I am binding to a C# ASP.NET 1.1 web page

datagrid.
I also
want to put an "Edit" column on the datagrid. However, whenever I use the following code, it puts the Edit column on the left. I cannot figure out how to get it to the right, as there is no DataGridTableStyle for ASP as
there is for an application.
I am doing the following on page load: (where dgItem is my datagrid):

EditCommandColumn editColumn = new EditCommandColumn();
editColumn.ButtonType = ButtonColumnType.LinkButton;
editColumn.CancelText = "Cancel";
editColumn.EditText = "Edit";
editColumn.HeaderText = "Edit";
editColumn.UpdateText = "Save";

dgItem.DataSource = ReturnsPopulatedDataTable();
dgItem.Columns.AddAt(1, editColumn);
/*also tried dgItem.Columns.AddAt(dgItem.Columns.Count, editColumn);

without
success*/
dgItem.DataBind();

The edit column keeps showing up on the far left of the grid. Any ideas

how
to get it to be added to the right side of the DataTable, instead?

Any help appreciated.
Thanks,

-John
xposted: microsoft.public.dotnet.framework.aspnet.datagrid 3/24/2005


Nov 19 '05 #3
as far as I know there is no way to do that and if you look at following
link will see the same answer

http://groups-beta.google.com/group/...ec2c2dbeb3f6e7

masoud
"John E." <PleaseReply@usenet> wrote in message
news:u5*************@TK2MSFTNGP12.phx.gbl...
Thanks for the response! Yes, I have it set to create columns at runtime.
Is there a way to put the fixed columns to the right of runtime columns
instead of their default location on the left?

Thanks,
-John
"masoud bayan" <ma**********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
One guess:
are you using datagrid with *create columns automatically at run time
option* chosen? if so it generates those columns at run time after the

fixed
columns. so you should disable it and assign columns at design time.

masoud

"John E." <PleaseReply@usenet> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl...
I have a datatable that I am binding to a C# ASP.NET 1.1 web page

datagrid.
I also
want to put an "Edit" column on the datagrid. However, whenever I use the following code, it puts the Edit column on the left. I cannot figure out how to get it to the right, as there is no DataGridTableStyle for ASP as there is for an application.
I am doing the following on page load: (where dgItem is my datagrid):

EditCommandColumn editColumn = new EditCommandColumn();
editColumn.ButtonType = ButtonColumnType.LinkButton;
editColumn.CancelText = "Cancel";
editColumn.EditText = "Edit";
editColumn.HeaderText = "Edit";
editColumn.UpdateText = "Save";

dgItem.DataSource = ReturnsPopulatedDataTable();
dgItem.Columns.AddAt(1, editColumn);
/*also tried dgItem.Columns.AddAt(dgItem.Columns.Count, editColumn);

without
success*/
dgItem.DataBind();

The edit column keeps showing up on the far left of the grid. Any
ideas how
to get it to be added to the right side of the DataTable, instead?

Any help appreciated.
Thanks,

-John
xposted: microsoft.public.dotnet.framework.aspnet.datagrid 3/24/2005



Nov 19 '05 #4

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

Similar topics

4
3561
by: Aaron Ackerman | last post by:
I am using typed datasets in an N-Tier Windows app using VB.NET. I know this posting cannot be fully explained in a single post that is why I am asking for someone to point me to a real world...
7
4212
by: Pete Davis | last post by:
A different question this time. I have a DataGrid bound to a collection. Is there any way for me to allow sorting? The DataGrid.AllowSorting=true doesn't work, but that's probably because it can't...
6
3218
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...
7
3066
by: tshad | last post by:
Is there a way to move a row in a Datalist up or down without having to re-read the data? I have a datalist which has embedded Datagrids in it. I want to allow the user to move a row up or down...
1
1667
by: Arthur Dent | last post by:
Heres the deal... i have a datagrid which displays products in a category. Any category has its own set of columns which show up in the grid, so it is defined as AutoGenerateColumns=True There...
4
1599
by: Raed Sawalha | last post by:
i have datagrid , I added a bound column and I need to map it with two data fields ...is this possible? <asp:datagrid id=dgInbox runat="server" EnableViewState="False"...
3
13561
by: Rich | last post by:
Hello, If my datagrid is based on a dataTable (t1) and the currency manager is also bound to t1 and I do a find on a key dim dRow As DataRow, t1 As DataTable .... dRow = t1.Rows.find(somekey)...
5
1400
by: acool | last post by:
I have been trying to do this for hours with only limited success. I have no idea why MS makes something that should be so straight forward a real pain. Can anyone point me in the right direction?
1
2352
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
0
7207
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
7291
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
7357
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...
0
7468
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
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
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 ...
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.