ASP:DropDownList的

时间:2010-11-04 22:09:12

标签: asp.net drop-down-menu

以下代码有效,但当验证失败时,下拉列表不会返回其原始值吗?

 <tr><td valign="top" style="padding-right: 10px;">
                            &nbsp;&nbsp;<b>Select Account:</b>
                            &nbsp;&nbsp;&nbsp;&nbsp;<asp:DropDownList ID="m_lstAccounts" runat="server" CausesValidation="true"  ValidationGroup="Group1" 
                            CssClass="dropdownList" OnSelectedIndexChanged="OnAccountChange" AutoPostBack="True"></asp:DropDownList>
                            <br />
                        <script type="text/javascript">
                            function ConfirmDropDownValueChange(source, arguments) {
                                if (document.all("AccountProfileDirty").value == "1") {
                                    arguments.IsValid = confirm("Are you sure you want to continue with out saving?");
                                    source.
                                }
                                else {
                                    arguments.IsValid = true;
                                }
                            } 
                        </script> 
                        <asp:CustomValidator ID="ConfirmDropDownValidator" runat="server" 
                            ClientValidationFunction="ConfirmDropDownValueChange" Display="Dynamic" ValidationGroup="Group1"  /> </td> </tr>

1 个答案:

答案 0 :(得分:1)

ConfirmDropDownValueChange()函数中间的随机source.是什么?这肯定会让JavaScript失败。