Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

929 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now