Solved

ASP.net GridView Radio Button field on Right

Posted on 2014-01-06
7
614 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ajax Panel Not Updating When Triggered By Timer 4 72
IIS Authorization for Web Service 2 46
ASP.NET MVC 2 31
Modal Popup Extender control 1 20
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…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

777 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