小编mat*_*amy的帖子

在asp.net控件中,此上下文不支持代码块

我正在创建一个html表.我想要隐藏表格行.我将属性runat=serverid特定行放在一起,但该行中有客户端代码,类似于以下代码.

<% if ((strFlag=="d") || (strApprvdFlag=="y")) {%>
Run Code Online (Sandbox Code Playgroud)

调用此行后,我收到此错误.

在asp.net控件中,此上下文不支持代码块.

以下是我的示例代码:

<table>
  <tr colspan="4" ID="trMedical"  scriptrunat="server">
    <td style="WIDTH: 45px;HEIGHT: 12px" align="left" class="LabelTaxText" width="45"><b>G&nbsp;
        </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)" …
Run Code Online (Sandbox Code Playgroud)

c# asp.net code-behind

11
推荐指数
2
解决办法
3万
查看次数

标签 统计

asp.net ×1

c# ×1

code-behind ×1