如何处理JS错误

时间:2013-08-30 06:55:15

标签: javascript asp.net

<ItemTemplate>
    <tr class="row">
        <td style="width: 88%;">
            <input id="hdnPackageProuctId" type="hidden" value='<%# Eval("ID")%>'  />
            <div style="float:left; margin-top:5px;height:18px;">
                 <input type="radio" id="ChkIsProduct" name="chkProductsList" onclick="hdnSelectedProdName.value='<%# HttpUtility.JavaScriptStringEncode(Eval("Name"))%>'; hdnSelectedProdID.value='<%# Eval("ID")%>';"     />&nbsp; 
            </div>
            <div style="float:left;font-size:12px;margin-top:5px; font-weight:bold; width:300px;height:18px;"  class="gvColSet tLightBlack gvtruncate" title='<%# Eval("Name")%>'>  
                <%# Eval("Name")%>  
            </div>
        </td>
        <td align="right" style="width: 12%;">
           <div id="dvPrice" class="gvColSet tLightBlack gvColAlignLeft" style="font-size:12px; float:left; width:95px;  "><%# FormatNumber(Eval("SalePrice"), 2)%></div>`enter code here`
           <input id="hdnUnitPrice" type="hidden" value='<%# FormatNumber(Eval("SalePrice"), 2)%>' />
        </td>
   </tr>
</ItemTemplate>

这是转发器的项目模板,但是当我点击复选框时:

onclick="hdnSelectedProdName.value = '<%# HttpUtility.JavaScriptStringEncode(Eval("Name"))%>';
hdnSelectedProdID.value='<%# Eval("ID")%>';

发生了JS错误我尽力但无法找到。

1 个答案:

答案 0 :(得分:0)

需要

onclick="hdnSelectedProdName.value = '<%# HttpUtility.JavaScriptStringEncode(Eval(\"Name\"))%>';
hdnSelectedProdID.value='<%# Eval(\"ID\")%>';