0

我是 jQuery 的新手,我现在正在使用 Visual Studio 2010 ASP.NET 页面选项卡。在第一个(开始)页面中,用户必须输入信息才能访问其他选项卡。如果用户没有输入任何信息,我想显示某种警报消息,显示:请输入您的信息。

我所做的是我使用 System.Windows.Forms 实现了 MessageBox.Show(),但如果我发布网页,这将不起作用。我应该如何使用 jQuery 对话框插件来做到这一点?

我有这样的事情:

    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript">
    $(function () {
        $("#dialog").dialog();
    });
    </script>

    Welcome! Please provide your Number to complete your application:

<asp:TextBox ID="txtSSN" runat="server" TextMode="Password" </asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
        ControlToValidate="txtSSN" ErrorMessage="*"></asp:RequiredFieldValidator>

<asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click" 
    Text="Submit" />


<div id="dialog"  style="display: none; ">
<p>Please Enter Your Credentials First!</p>
</div>
</asp:Content>
4

1 回答 1

1

您可以使用带有选项 ShowMessageBox="True" 的 ValidationSummary 控件。就像是:

<asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="The following are required:" ShowMessageBox="True" ShowSummary="False" />

如果您没有找到有关如何使用它的教程,请告诉我。

于 2011-04-28T20:09:20.590 回答