Solved

ASP.net GridView - put extra columns last instead of first

Posted on 2011-09-29
2
218 Views
Last Modified: 2012-05-12
Hi

I am using the code shown below to put 5 extra radio buttons at as the first five columns of
a Gridview. How do I modify this code to make them the last 5 columns after the bound data?

Thanks
<asp:GridView ID="GridView2" runat="server" CellPadding="4" 
            ForeColor="#333333" GridLines="None">  
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns> 
                <asp:TemplateField>
                   <ItemTemplate>
                       <asp:RadioButton ID="RadioButton1" runat="server" />
                  </ItemTemplate>
               </asp:TemplateField> 
                      <asp:TemplateField>
                   <ItemTemplate>
                       <asp:RadioButton ID="RadioButton2" runat="server" />
                  </ItemTemplate>
               </asp:TemplateField> 
                      <asp:TemplateField>
                   <ItemTemplate>
                       <asp:RadioButton ID="RadioButton3" runat="server" />
                  </ItemTemplate>
               </asp:TemplateField> 
                      <asp:TemplateField>
                   <ItemTemplate>
                       <asp:RadioButton ID="RadioButton4" runat="server" />
                  </ItemTemplate>
               </asp:TemplateField> 
                      <asp:TemplateField>
                   <ItemTemplate>
                       <asp:RadioButton ID="RadioButton5" runat="server" />
                  </ItemTemplate>
               </asp:TemplateField> 
            </Columns> 
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />  
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />  
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />  
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />  
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />  
            <SortedAscendingCellStyle BackColor="#E9E7E2" />  
            <SortedAscendingHeaderStyle BackColor="#506C8C" />  
            <SortedDescendingCellStyle BackColor="#FFFDF8" />  
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />  
        </asp:GridView>

Open in new window

0
Comment
Question by:murbro
2 Comments
 
LVL 10

Accepted Solution

by:
JPJ78 earned 500 total points
ID: 36814053
If it is possible I would imagine setting autogenerateColumns="true" would be the answer.
But as far as I know you can't mix autogenerated columns with user defined columns, you simple have to define the columns that are normally autogenerated.
0
 

Author Closing Comment

by:murbro
ID: 36918537
thanks for the help
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question