0

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>
RG-3
  • 6,088
  • 19
  • 69
  • 125

1 Answers1

1

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.

cheedep
  • 937
  • 6
  • 19
  • Thanks. But I want to use something like this: http://jqueryui.com/demos/dialog/#modal – RG-3 Apr 28 '11 at 20:47
  • Yeah I understand the ValdationSummary's message box is not so pretty :) You can do client side validation and call .dialog( "open" ) if validation fails. Here is a SO answer that shows how to use the client-side validation call http://stackoverflow.com/questions/969465/problem-with-page-clientvalidate – cheedep Apr 29 '11 at 20:47