Solved

ASP.net GridView Radio Button field on Right

Posted on 2014-01-06
7
604 Views
Last Modified: 2014-01-06
Hi

I have a radio button template field in my ASP.net GridView
I want it to appear on the right instead of the left on the data load
but can't seem to find how to do this. I was told to use horizontal alignment
to the right. How would I change the following markup to achieve this?


         <asp:GridView ID="GridView_Questions" runat="server" BackColor="White"
                BorderColor="#3366CC" BorderStyle="Solid" BorderWidth="1px" CellPadding="4"
                Height="147px" Visible="False" Width="795px">
                <Columns>
       
            <asp:TemplateField HeaderText="1">
                 <ItemTemplate>
                     <asp:RadioButtonList  ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
                         <asp:ListItem Value="1">Yes</asp:ListItem>
                         <asp:ListItem Value="0">No</asp:ListItem>      
                     </asp:RadioButtonList>
                     </ItemTemplate>
            </asp:TemplateField>
0
Comment
Question by:murbro
  • 5
  • 2
7 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
Do you mean you want the radio buttons to appear at the right of the cell, or you want the text to appear to the right of the radio button?
0
 

Author Comment

by:murbro
Comment Utility
Hi

I want the actual template column to appear to the right of the data that loads
from my SQL table
I tried the following and it didn't work
            <asp:TemplateField HeaderText="1" ItemStyle-HorizontalAlign="Right">
                 <ItemTemplate>
                     <asp:RadioButtonList  ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
                         <asp:ListItem Value="1">Yes</asp:ListItem>
                         <asp:ListItem Value="0">No</asp:ListItem>      
                     </asp:RadioButtonList>
                     </ItemTemplate>
            </asp:TemplateField>
0
 

Author Comment

by:murbro
Comment Utility
So in the following image my SQL data loads into the columns that I have surrounded in red
All the other columns to the left are template columns. I want them to rather appear to the right

1
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
Comment Utility
Ah, ok. In that case the only way to do it is to set AutoGenerateColumns to false and manually add a set of asp:BoundFields for your SQL columns rather than letting them be generated automatically.

If you leave them to be created automatically they will go on the end by default.
0
 

Author Comment

by:murbro
Comment Utility
Ah very interesting. Thanks. I'll post a further question on how to do this
0
 

Author Closing Comment

by:murbro
Comment Utility
Thanks very much
0
 

Author Comment

by:murbro
Comment Utility
Hi

I posed the following question relating to your answer
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_28331351.html
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

14 Experts available now in Live!

Get 1:1 Help Now