简体   繁体   English

获取服务器标签的格式错误

[英]getting server tag is not well formed error

        <script type="text/javascript" language="javascript">
        function EnableDisablePkgInclusionDropDown(chkBox,index) {
                alert("RowIndex: " + (index - 1));
                var repeater = document.getElementById('<%= pnlrptPckgInclusions.ClientID %>');
                var dropdowns = repeater.getElementsByTagName('select');
                if ($(chkBox).is(':checked')) {
                    dropdowns[index - 1].disabled = true;
                    dropdowns[index - 1].selectedIndex = document.getElementById('<%=ddlMarkUpBasis.ClientID%>').selectedIndex;
                }
                else {
                    dropdowns[index - 1].disabled = false;
                    dropdowns[index - 1].selectedIndex = "0";
                }
            }
        </script>

    <asp:Repeater runat="server" ID="rptPckgInclusions">      
    <ItemTemplate> 
<td align="center" style="width: 20%;">
        <input type="checkbox" runat="Server"  ID="chkApplyParentMarkUp" OnClick='EnableDisablePkgInclusionDropDown(this,<%#DataBinder.Eval(Container.DataItem, "ID") %>);' />
</td>
    </ItemTemplate> 
    </asp:Repeater>

If i remove runat ="server" from checkbox then its working fine but i want this control's value in code-behind. 如果我从复选框中删除runat =“ server”,那么它可以正常工作,但是我希望此控件的值位于代码后。

Why is it so?? 为什么会这样呢?

Thanks in advance 提前致谢

Use something like that 使用类似的东西

<asp:CheckBox runat="server" ID="chkApplyParentMarkUp" OnCheckedChanged='EnableDisablePkgInclusionDropDown(this,<%#DataBinder.Eval(Container.DataItem, "ID") %>);' />

Because you can not define input type checkbox as runat="server" . 因为您不能将输入类型复选框定义为runat="server" And use OnCheckedChanged Event on behalf on onClick event. 并代表onClick事件使用OnCheckedChanged事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM