在aspx页面中预期')'

时间:2013-11-04 10:33:35

标签: c# asp.net checkboxlist

我收到错误“预期”)'“

页面已成功加载,但在浏览器页脚状态“Done with errors”

的.aspx

<td align="left" valign="top" style="width: 18%;">
   <div id="Div2" style="overflow:auto;height:120px;">
       <asp:CheckBoxList ID="chklstCourse" DataTextField="CourseName" DataValueField="CourseName" runat="server"></asp:CheckBoxList>
   </div>
</td>

<td align="left" valign="top" style="width: 18%;">
    <div id="Div4" style="overflow:auto;height:120px;">
       <asp:CheckBoxList ID="chklstCategory" DataTextField="Category" DataValueField="Category" runat="server"></asp:CheckBoxList>
    </div>
</td>
<td align="left" valign="top" style="width: 18%;">
    <div id="Div5" style="overflow:auto;height:120px;">
         <asp:CheckBoxList ID="chklstSubCat" DataTextField="SubCategory" DataValueField="SubCategory" runat="server"></asp:CheckBoxList>
    </div>
</td>

查看来源:

<tr>
                <td><input id="ctl00_PageMainContent_filterPane_content_chklstCourse_0" type="checkbox" name="ctl00$PageMainContent$filterPane_content$chklstCourse$0" checked="checked" onclick="SelectAll(&#39;ctl00_PageMainContent_filterPane_content_chklstCourse&#39;,0);" /><label for="ctl00_PageMainContent_filterPane_content_chklstCourse_0">Select All</label></td>
            </tr><tr>
                <td><input id="ctl00_PageMainContent_filterPane_content_chklstCourse_1" type="checkbox" name="ctl00$PageMainContent$filterPane_content$chklstCourse$1" checked="checked" onclick="SelectAll(&#39;ctl00_PageMainContent_filterPane_content_chklstCourse&#39;,7 Habits of Highly Effective People);" /><label for="ctl00_PageMainContent_filterPane_content_chklstCourse_1">7 Habits of Highly Effective People</label></td>
            </tr><tr>
                <td><input id="ctl00_PageMainContent_filterPane_content_chklstCourse_2" type="checkbox" name="ctl00$PageMainContent$filterPane_content$chklstCourse$2" checked="checked" onclick="SelectAll(&#39;ctl00_PageMainContent_filterPane_content_chklstCourse&#39;,Advanced Networking for EBI/DVM);" /><label for="ctl00_PageMainContent_filterPane_content_chklstCourse_2">Advanced Networking for EBI/DVM</label></td>
            </tr><tr>

在视图源中,checkboxlist控件onclick事件自动添加,这背后有什么问题吗?

有什么想法吗?提前致谢

1 个答案:

答案 0 :(得分:0)

这两个函数调用中的第一个参数用引号(&#39;)包装,第二个参数是否也需要?

SelectAll(&#39;ctl00_PageMainContent_filterPane_content_chklstCourse&#39;,Advanced Networking for EBI/DVM);
SelectAll(&#39;ctl00_PageMainContent_filterPane_content_chklstCourse&#39;,7 Habits of Highly Effective People);

第二个参数看起来像一个字符串,但它们没有被引用。