Professional Web Applications Themes

Move bound column to right of dynamic column in datagrid? - ASP.NET Data Grid Control

I have a datatable that I am binding to a C# ASP.NET 1.1 web page. 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 = ...

  1. #1

    Default 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. 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);
    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


    John E. Guest

  2. #2

    Default Move bound column to right of dynamic column in datagrid?

    Hi John,

    Instead

    dgItem.Columns.AddAt(1, EditColumn);

    You can use

    dgItem.Columns.AddAt(dgItem.Columns.Count, EditColumn);

    to put Edit column on the right side.

    HTH

    Elton Wang
    [email]elton_wanghotmail.com[/email]

    >-----Original Message-----
    >I have a datatable that I am binding to a C# ASP.NET 1.1
    web page. 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);
    >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
    >
    >
    >.
    >
    Elton Wang Guest

  3. #3

    Default Re: Move bound column to right of dynamic column in datagrid?

    Thanks for the response! Unfortunately I had tried that earlier and it does
    not work either. The "edit" is still on the left side.

    Any other ideas?

    Thank you,
    -John

    "Elton Wang" <anonymousdiscussions.microsoft.com> wrote in message
    news:0f9f01c530cd$829fd930$a401280aphx.gbl...
    > Hi John,
    >
    > Instead
    >
    > dgItem.Columns.AddAt(1, EditColumn);
    >
    > You can use
    >
    > dgItem.Columns.AddAt(dgItem.Columns.Count, EditColumn);
    >
    > to put Edit column on the right side.
    >
    > HTH
    >
    > Elton Wang
    > [email]elton_wanghotmail.com[/email]
    >
    >
    > >-----Original Message-----
    > >I have a datatable that I am binding to a C# ASP.NET 1.1
    > web page. 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);
    > >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
    > >
    > >
    > >.
    > >

    John E. Guest

  4. #4

    Default Re: Move bound column to right of dynamic column in datagrid?

    I don't know if your dgItem has any special setting,
    otherwise either
    dgItem.Columns.AddAt(dgItem.Columns.Count, EditColumn);
    or
    dgItem.Columns.Add(EditColumn);

    should locate EditColumn at right side.

    HTH

    Elton Wang
    >-----Original Message-----
    >Thanks for the response! Unfortunately I had tried that
    earlier and it does
    >not work either. The "edit" is still on the left side.
    >
    >Any other ideas?
    >
    >Thank you,
    >-John
    >
    >"Elton Wang" <anonymousdiscussions.microsoft.com> wrote
    in message
    >news:0f9f01c530cd$829fd930$a401280aphx.gbl...
    >> Hi John,
    >>
    >> Instead
    >>
    >> dgItem.Columns.AddAt(1, EditColumn);
    >>
    >> You can use
    >>
    >> dgItem.Columns.AddAt(dgItem.Columns.Count, EditColumn);
    >>
    >> to put Edit column on the right side.
    >>
    >> HTH
    >>
    >> Elton Wang
    >> [email]elton_wanghotmail.com[/email]
    >>
    >>
    >> >-----Original Message-----
    >> >I have a datatable that I am binding to a C# ASP.NET
    1.1
    >> web page. 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);
    >> >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
    >> >
    >> >
    >> >.
    >> >
    >
    >
    >.
    >
    Elton Wang Guest

Similar Threads

  1. Bound datatable + unbound column in datagrid
    By Gary Frank in forum ASP.NET Data Grid Control
    Replies: 3
    Last Post: August 25th, 08:28 PM
  2. update datagrid with dynamic bound column
    By don in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: April 26th, 09:21 PM
  3. datagrid cell and bound column
    By BartVDA in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: June 11th, 03:42 PM
  4. Bound Column or Template Column (w dAdapater?) in DataGrid
    By Ravichandran Mahalingam in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: January 9th, 03:30 PM
  5. How to use formatting expression on DataGrid bound column.
    By Sonali.NET[MVP] in forum ASP.NET General
    Replies: 0
    Last Post: June 25th, 02:18 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139