无法在我的屏幕中看到单选按钮列表

时间:2013-12-14 05:44:20

标签: asp.net c#-4.0 radiobuttonlist

我无法在屏幕上看到单选按钮列表是或否我从XML文件中获取值。

在aspx页面中的代码:

     <asp:Panel ID="pnlAction" runat="server" Width="100%" Visible="false">

  <table cellpadding="0" cellspacing="0" border="0" width="99%">
<tr style="height: 20px;">
    <td style="width: 25px;">
        <hr />
    </td>
    <td class="secHeading frmlblBold"" style="width: 80px;" align="center">
        Action
    </td>
    <td>
        <hr />
    </td>
</tr>
</table>
<table style="font-weight:normal" width="100%" border="0" cellpadding="2" cellspacing="2">
<tr>
    <td style="width:250px;"></td>
    <td style="width:350px;"></td>
    <td style="width:250px;"></td>
    <td style="width:350px;"></td>
</tr>

<tr>
  <td class="frmlblBold" style="text-align:right;vertical-align:top">Action </td>
    <td><asp:DropDownList ID="ddlAction" runat="server" CssClass="DropDown" DataSourceID="dsAction" DataValueField="CODE" DataTextField="CDDesc" AutoPostBack = "False" Width="342px"></asp:DropDownList></td>
</tr>
<tr>
<td class="frmlblBold" style="text-align:right;vertical-align:top">Service Agreement Clause </td>
            <td  style="vertical-align:top" style="width: 350px;">
           <%-- <fieldset id="fldSLA" runat="server" style="width: 280px;">--%>
                <asp:RadioButtonList ID="radSLA" runat="server" RepeatDirection="Horizontal" DataValueField="SLAID" DataTextField="SLADESC" DataSourceID="dsSLA" visible = "true">
                </asp:RadioButtonList>
                <asp:RequiredFieldValidator ID="rfvSLA" runat="server" ControlToValidate="radSLA" ErrorMessage="Please select if service agreement is applicable or not."
                Enabled="true" Display="none"></asp:RequiredFieldValidator>
              <%--  </fieldset>--%>
        </td>    

 </tr>
 <tr>
 <td class="frmlblBold" style="text-align:right;vertical-align:top">Comments </td>
            <td  style="vertical-align:top">
         <asp:TextBox runat="server" ID="txtActionComments" MaxLength="500" TextMode="MultiLine" width="95%" Rows="5" />  </td>                                                                             
 </tr>
         <tr>
         <td  align="center" colspan="2">
         <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" CssClass="btnOther" />
         </tr>   
            </asp:Panel>

<asp:XmlDataSource ID="dsSLA" runat="server" EnableCaching="false" DataFile="~/XML/VisaTracking.xml"
    XPath="BVILetter/SLA/ITEM" />

.cs文件中的代码:

if (!IsPostBack)
        {
            base.PageLoad();
            GetReqPndActTknByMe(base.LogShortID);
            radSLA.DataBind();
            radSLA.SelectedValue = "Yes";
            BindDataToDropdownListAction();
        }

我能看到radSLA.DataBind()的行数;为'2'

My XML code:
<BVILetter>
  <SLA>
<ITEM SLAID ="Yes" SLADESC ="Yes" />
<ITEM SLAID ="No" SLADESC ="No" />
</SLA>
</BVILetter>

但我无法在屏幕上看到单选按钮:

enter image description here

请帮帮我。

1 个答案:

答案 0 :(得分:0)

请清楚检查装订功能。如果绑定没有正确发生,则RadioBottonList不会出现.RadioBottonList只有当listItem正确绑定时才会出现