Solved

ASP.net GridView Radio Button field on Right

Posted on 2014-01-06
7
618 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
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:murbro
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:murbro
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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:murbro
ID: 39758967
Ah very interesting. Thanks. I'll post a further question on how to do this
0
 

Author Closing Comment

by:murbro
ID: 39758968
Thanks very much
0
 

Author Comment

by:murbro
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 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