Radio button in multiple columns
I have a table in which I have to place radio buttons in multiple columns. From all these buttons, only one radio button can be checked. How to achieve these. I have five columns viz.A,B,C,D,E and I want to place radio button for each column. //Here is the code for my .aspx page
<%@ Page Title="" Language="C#" MasterPageFile="~/Interviewer
/interviewerMasterPage.master" AutoEventWireup="true" CodeFile="AppRatingForm.aspx.cs"
Inherits="Interviewer_AppRatingForm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table cellpadding="2" width="100%">
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td align="center" class="tdtitle" colspan="2">
Interview Rating Form</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td width="25%">
Name of Applicant</td>
<td>
<asp:Label ID="nameLbl" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td>
Post Applied For</td>
<td>
</td>
</tr>
<tr>
<td>
Department</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td align="center" class="tdtitle" colspan="2">
Assessment</td>
</tr>
<tr>
<td align="left" colspan="2">
<table border="1" cellpadding="3" cellspacing="0" class="style1">
<tr>
<td align="center"
style="font-family: 'Times New Roman', Times, serif; font-size: large; font-weight: bold"
width="5%">
No</td>
<td align="center"
style="font-family: 'Times New Roman', Times, serif; font-size: large; font-weight: bold"
width="25%">
Traits</td>
<td align="center"
style="font-family: 'Times New Roman', Times, serif; font-size: large; font-weight: bold"
width="8%">
A</td>
<td align="center"
style="font-family: 'Times New Roman', Times, serif; font-size: large; font-weight: bold"
width="8%">
B</td>
<td align="center"
style="font-family: 'Times New Roman', Times, serif; font-size: large; font-weight: bold"
width="8%">
C</td>
<td align="center"
style="font-family: 'Times New Roman', Times, serif; font-size: large; font-weight: bold"
width="8%">
D</td>
<td align="center"
style="font-family: 'Times New Roman', Times, serif; font-size: large; font-weight: bold"
width="8%">
E</td>
<td align="center"
style="font-family: 'Times New Roman', Times, serif; font-size: large; font-weight: bold"
width="*">
Comments</td>
</tr>
<tr>
<td colspan="8"
style="font-family: 'Times New Roman', Times, serif; font-size: medium; font-weight: bold;">
Personal Traints</td>
</tr>
<tr>
<td>
1</td>
<td>
Personality</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
2</td>
<td>
Physical Fitness</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
3</td>
<td>
Background</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
4</td>
<td>
Confidance</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
5</td>
<td>
Communication Skills</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
6</td>
<td>
Attitude</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr&g开发者_JAVA百科t;
<td colspan="8"
style="font-family: 'Times New Roman', Times, serif; font-size: medium; font-weight: bold;">
Job Related Traits</td>
</tr>
<tr>
<td>
1</td>
<td>
Subject Knowledge</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
2</td>
<td>
Related Work Experience</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
3</td>
<td>
Integrity</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
4</td>
<td>
Reliability</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
5</td>
<td>
Adaptability</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
6</td>
<td>
Initiative</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
7</td>
<td>
Team Work</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
8</td>
<td>
Ethics</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" class="tdtitle" colspan="2">
</td>
</tr>
<tr>
<td align="center" colspan="2">
</td>
</tr>
<tr>
<td align="center" colspan="2">
</td>
</tr>
</table>
</asp:Content>
There is GroupName
property of the radio button that you need to set for each column.
In your column A, set all radio button's to GroupName="A"
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="A" />
In your column B, set all radio button's to GroupName="B"
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="B" />
This will allow the user to only select one radio button from each column.
精彩评论