Solved

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

Posted on 2011-09-29
2
217 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 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