Question

I am NEW in jQuery and I am using Visual Studio 2010 ASP.NET Pages Tabs for now. In the first (Start) page User have to enter information to access other tabs. If User has not entered any info I want to show some kind of alert mesg that displays: Please Enter your Info.

What I did is that I implemented MessageBox.Show() using System.Windows.Forms, but that is not gonna work if I am publishing the webpage. How should I do it with jQuery Dialog Box Plugin?

I have something like this:

    <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>
Was it helpful?

Solution

You can use the ValidationSummary control with option ShowMessageBox="True". Something like:

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

Let me know if you do not find a tutorial on how to use it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top