多列中的单选按钮

时间:2011-05-11 05:50:19

标签: asp.net

我有一张桌子,我必须将单选按钮放在多列中。从所有这些按钮,只能检查一个单选按钮。如何实现这些。我有五列,即A,B,C,D,E,我想为每列放置单选按钮。 //这是我的.aspx页面的代码

 <%@ 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">
            &nbsp;</td>
    </tr>
    <tr>
        <td align="center" class="tdtitle" colspan="2">
            Interview Rating Form</td>
    </tr>
    <tr>
        <td colspan="2">
            &nbsp;</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>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            Department</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td colspan="2">
            &nbsp;</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>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        2</td>
                    <td>
                        Physical Fitness</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        3</td>
                    <td>
                        Background</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        4</td>
                    <td>
                        Confidance</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        5</td>
                    <td>
                        Communication Skills</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        6</td>
                    <td>
                        Attitude</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <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>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        2</td>
                    <td>
                        Related Work Experience</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        3</td>
                    <td>
                        Integrity</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        4</td>
                    <td>
                        Reliability</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        5</td>
                    <td>
                        Adaptability</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        6</td>
                    <td>
                        Initiative</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        7</td>
                    <td>
                        Team Work</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        8</td>
                    <td>
                        Ethics</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td align="center" class="tdtitle" colspan="2">
            &nbsp;</td>
    </tr>
    <tr>
        <td align="center" colspan="2">
            &nbsp;</td>
    </tr>
    <tr>
        <td align="center" colspan="2">
            &nbsp;</td>
    </tr>
</table>
</asp:Content>

1 个答案:

答案 0 :(得分:1)

您需要为每列设置单选按钮的GroupName属性。

在A栏中,将所有单选按钮设为GroupName="A"

<asp:RadioButton ID="RadioButton1" runat="server" GroupName="A" />

在B栏中,将所有单选按钮设为GroupName="B"

<asp:RadioButton ID="RadioButton1" runat="server" GroupName="B" />

这将允许用户只从每列中选择一个单选按钮。