Move bound column to right of dynamic column in datagrid?

Discussion in 'ASP .Net' started by John E., Mar 25, 2005.

  1. John E.

    John E. Guest

    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
     
    John E., Mar 25, 2005
    #1
    1. Advertising

  2. John E.

    masoud bayan Guest

    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:...
    > 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
    >
    >
     
    masoud bayan, Mar 25, 2005
    #2
    1. Advertising

  3. John E.

    John E. Guest

    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" <> wrote in message
    news:%...
    > 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:...
    > > 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
    > >
    > >

    >
    >
     
    John E., Mar 25, 2005
    #3
  4. John E.

    masoud bayan Guest

    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... columns to the right&rnum=1#73ec2c2dbeb3f6e7

    masoud


    "John E." <PleaseReply@usenet> wrote in message
    news:...
    > 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" <> wrote in message
    > news:%...
    > > 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:...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
     
    masoud bayan, Mar 25, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sunil panda

    Lower bound & Upper bound

    sunil panda, Dec 25, 2003, in forum: Java
    Replies:
    9
    Views:
    7,300
    thushara wijeratna
    Oct 7, 2008
  2. Isaac Grover

    How to move this right column up

    Isaac Grover, Jun 18, 2007, in forum: HTML
    Replies:
    7
    Views:
    449
    Ben C
    Jun 18, 2007
  3. Ravichandran Mahalingam

    Bound Column or Template Column (w dAdapater?) in DataGrid

    Ravichandran Mahalingam, Jan 9, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    232
    Ravichandran Mahalingam
    Jan 9, 2004
  4. John E.

    Move bound column to right of dynamic column in datagrid?

    John E., Mar 24, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    242
    Elton Wang
    Mar 28, 2005
  5. don

    update datagrid with dynamic bound column

    don, Apr 26, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    169
Loading...

Share This Page