Solved

ASP.net GridView Radio Button field on Right

Posted on 2014-01-06
7
625 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:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39758926
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:Murray Brown
ID: 39758947
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:Murray Brown
ID: 39758954
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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39758964
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:Murray Brown
ID: 39758967
Ah very interesting. Thanks. I'll post a further question on how to do this
0
 

Author Closing Comment

by:Murray Brown
ID: 39758968
Thanks very much
0
 

Author Comment

by:Murray Brown
ID: 39758970
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

628 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