2013-12-14 27 views
0

我无法看到单选按钮列表是或否在我的屏幕中我正在从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

请帮助我。

+0

你可以发布你的代码清楚吗 –

回答

0

请仔细检查绑定功能。如果绑定不正确,那么RadioBottonList不会出现.RadioBottonList apear只有当listItem绑定的时候

+0

请告诉我如何检查?... radSLA.DataBind()是不抛出任何错误,我打包看到radsSLA项目计数为'2' – user1912987

+0

检查您的DataSourc值之前绑定它并调用您的radsSLA.DataSource和radsSLA.DataSourceID befor绑定 –

+0

是我在绑定之前caleld datasourceid,但怎么可以ic heck是否获取数据...我需要从xml中获取2个值是或否,因为在radSLA.DataBind()中我得到了它们,radSLA项目计数显示为'2'。 – user1912987