asp转发器模板条件验证javascript

时间:2017-12-04 13:15:35

标签: javascript asp.net templates repeater

我有一个asp转发器,它有一些项目信息,一个接受按钮,一个取消按钮和取消文本框的原因。我希望取消按钮验证取消中是否有一些文本(如果没有弹出“你需要输入原因”)。我希望接受按钮只是在页面上提交项目。这是我的尝试,但该函数不想查找(绑定)txtReason

<asp:UpdatePanel runat="server" ID="updatePanelAcceptOrReject">
    <ContentTemplate>
        <asp:Repeater runat="server" ID="AcceptOrRejectRepeater" OnItemDataBound="AcceptOrRejectRepeater_ItemDataBound">
            <ItemTemplate>
                <asp:Label ID="lblDescription" runat="server" Text='<%# Bind("ItemDescription")%>'></asp:Label
                <asp:Label ID="lblReasonForCancelling" runat="server" Text="Reason for rejection"></asp:Label>
                <asp:TextBox runat="server" ID="txtReason"></asp:TextBox>
                <script type="text/javascript">
                    function fnCheckforCancelReason() {
                        var pgng = document.getElementById('<%=txtReason.ClientID%>').value.trim();
                        if (pgnd == "") {
                            alert('The textbox should not be empty...');
                            document.getElementById(txtReason).focus();
                            return false;
                        }
                    }
               </script>
               <asp:Button ID="btnReject" runat="server" Text="Reject" CommandArgument='<%# Bind("ItemID") %>' OnClientClick="javascript:return fnCheckforCancelReason()" OnClick="btnReject_Click" />
                <asp:Button ID="btnAccept" runat="server" Text="Accept" CommandArgument='<%# Bind("ItemID") %>' OnClick="btnAccept_Click" />
            </ItemTemplate>
        </asp:Repeater>
    </ContentTemplate>
</asp:UpdatePanel>

但该函数不想查找(绑定)txtReason而且我无法设置断点(chronme或ie)

我希望能够设置一个断点来调试fnCheckforCancelReason

1 个答案:

答案 0 :(得分:1)

错误的pgng:

    $pkeyid = openssl_pkey_get_private("file://amp-private-key.pem");