Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.net GridView Radio Button field on Right

Posted on 2014-01-06
7
Medium Priority
?
628 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
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!

 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 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

Industry Leaders: 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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

688 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