我创建了一个html表格。我想隐藏表格行。我将属性runat=server
和id
用于特定的行,但该行中的客户端代码类似于以下代码。代码块在asp.net控件的上下文中不受支持
<% if ((strFlag=="d") || (strApprvdFlag=="y")) {%>
打完电话后,我得到了这个错误。
代码块是不是在这方面在asp.net控件支持。
下面是我的示例代码:
<table>
<tr colspan="4" ID="trMedical" scriptrunat="server">
<td style="WIDTH: 45px;HEIGHT: 12px" align="left" class="LabelTaxText" width="45"><b>G
</b>
</td>
<td style="WIDTH: 182px;HEIGHT: 12px" class="LabelTaxText" align="left" width="182"
colSpan="2">Medical
</td>
<td style="WIDTH: 81px; HEIGHT: 12px" align="right" class="LabelTaxText" width="81">
<asp:textbox onchange="onChangeFlag(),intOnly(this);" onkeyup="intOnly(this);" onkeypress="return CheckNumericWithOutDecimals(event)"
id="TxtMedical" tabIndex="24" runat="server" Width="96px" MaxLength="12" style="Z-INDEX: 0"></asp:textbox>
</td>
<% if ((strFlag=="d") || (strApprvdFlag=="y")) {%>
<td class="LabelTaxText" style="WIDTH: 107px; HEIGHT: 12px" align="right" width="107">
<asp:textbox onchange="onChangeFlag(),intOnly(this);" onkeyup="intOnly(this);" onkeypress="return CheckNumericWithOutDecimals(event)" id="TxtMedicalProof" tabIndex="24" onblur="charAlert(TxtMedical,TxtMedicalProof)" runat="server" MaxLength="12" Width="96px">
</asp:textbox>
</td>
<% } %>
<% if (strApprvdFlag=="y") {%>
<td class="LabelTaxText" style="WIDTH: 68px; HEIGHT: 24px" align="right" width="68">
<asp:textbox id="TxtMedicalApproved" tabIndex="24" runat="server" MaxLength="12" Width="96px"></asp:textbox>
</td>
<td class="LabelTaxText" style="WIDTH: 43px">
<asp:Label ID="lblMedicalRemarks" Runat="server"></asp:Label>
</td>
<% } %>
</tr>
</table>
喜非常感谢你..我得到这个错误服务器标签不能包含<% ... %>构造。 – mathirengasamy 2011-02-01 15:14:28
你的行不能有runat ='server'在里面。 – Keltex 2011-02-01 15:15:20