Click here to Skip to main content
15,895,011 members
Articles / Web Development / ASP.NET

Source Code for JQuery ASP.NET Controls

Rate me:
Please Sign up or sign in to vote.
4.56/5 (15 votes)
10 Jun 2009CPOL 67.6K   3.7K   93  
Get a start to building your own JQuery Controls
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JQueryDialogPage.aspx.cs" Inherits="TestApp.JQueryDialogPage" %>

<%@ Register Assembly="Mullivan.Web" Namespace="Mullivan.Web.UI.WebControls" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>JQuery Dialog</title>
    <link href="/CSS/jquery171.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        
        
        <input ID="Button1" type="button" onclick="PopDialog();" title="Show Dialog" 
            value="Show Dialog" ></input>
        <cc1:JQueryDialog ID="JQueryDialog1" runat="server" AutoOpen="false" 
            DialogButtons="YesNoCancel" OnClientValidateDialog="ValidateMyControls" OnClientDialogClosedCallback="__MyCallback" UseBgiFrame="False">
            This is my test dialog control. How do you like it?<br />
            <br />
            Date with validation<br />
            <cc1:JQueryDatePicker ID="JQueryDatePicker1" runat="server" width="80px"></cc1:JQueryDatePicker>
            <br />
            <br />
            <asp:Button ID="Button2" runat="server" onclick="Button2_Click1" 
                Text="Do Postback" />
            <br />
            <br />
        </cc1:JQueryDialog>
        
    </div> <script language="javascript" type="text/javascript">

        function __MyCallback(control, result)
        {
            alert('You selected ' + DialogResult.ConvertToString(result));
        }
        
        function ValidateMyControls(event, control, result)
        {
            if(result == DialogResult.Yes && jqJQueryDatePicker1[0].value == '')
            {
                 alert('You must select a date.');
                 return false;
            }
            return true;
        }

        function PopDialog() {
            <%= JQueryDialog1.ClientJQueryControlId %>.dialog('open', <%= JQueryDialog1.OnClientDialogClosedCallback %>);
        }
    
    </script>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions