![]() |
Web Development »
ASP.NET Controls »
General
Beginner
License: The GNU General Public License (GPL)
Write jQuery Plugin WebControl for ASP.NET Just in Few Minutes!By Ray_LiangWrite jQuery plugin WebControl for ASP.NET just in few miniutes! |
C# (C#2.0, C#3.0), Javascript, CSS, HTML, XHTML, .NET (.NET2.0, .NET3.0, .NET3.5), ASP, ASP.NET, WebForms, Ajax, Architect, Dev, Design
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
2009/6/8 The DJ v1.1.15 is released. click here to get the new download.
jQuery is a lightweight open source JavaScript library (only 15kb in size) that in a relatively short span of time has become one of the most popular libraries on the web. "write less do more" is a very good idea for our web developers. But when using it in ASP.NET something had happened...
We had a challenge of using jQuery in ASP.NET as well.
$(function() {
$("#datepicker").datepicker(
buttonText:'Close',
changeMonth:true,
changeYear:true,
gotoCurrent:true,
showOn:'click',
onselect:function(){
///.....
});
});
over 5 options that i can't remember any more....
<div id="accordion">
<h3>
<a href="#">Section 1</a></h3>
<div>
Section 1 content here
</div>
<h3>
<a href="#">Section 2</a></h3>
<div>
Section 2 content here
</div>
<h3>
<a href="#">Section 3</a></h3>
<div>
Section 3 content here
</div>
</div>
So how can I "write less do more" ?! I write a lot of code for using jQuery!
Against such a background, I build a lightweight framework for jQuery in ASP.NET named "DJ".
INamingContainer, IPostbackEventHandler, IPostbackDataHandler. So the server control's code looks just like this:
using System;
using System.Web.UI;
using DNA.UI; //step1:Import the DNA.UI library
//step2: add the JQuery Attribute to your control class header
[JQuery(Assembly="jQuery",Name="lightbox",ScriptResources=new string[]
{"plugin.lightbox.js"})]
public class LightBox:Control
{
//step3: add the JQueryOption Attribute to the property header
[JQueryOption(Name = "fixedNavigation")]
public bool FixedNavigation { get; set; }
protected override void OnPreRender(EventArgs e)
{
//step4: Register the jQuery Control
DNA.UI.ClientScriptManager.RegisterJQueryControl(this);
base.OnPreRender(e);
}
}
It's great! In just four steps, I wrote the lightbox Server Control! So I wrote all widgets of jquery.ui in "DJ" so that you can use theme to build your ASP.NET application quickly or you can using this framework to write your own jquery Server Controls!
See the difference between using pure jquery client script and DJ WebControl:
If you want to see more live demo of "DJ", you can visit my website and I put the latest version source code on CodePlex.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 9 Jun 2009 Editor: Deeksha Shenoy |
Copyright 2009 by Ray_Liang Everything else Copyright © CodeProject, 1999-2010 Web18 | Advertise on the Code Project |