Is it too late to say I love jQuery too?
jQuery is lightweight javascript framework with lots of support on the net and a big library of plug ins. Given the amount of client side content that is going to be knocking around in Visual studio 2008, I’d say it’s a good time to brush up on your jscript skills. While you are at it, make sure you check out this library to give you a leg up. Communication between jQuery and ASP.NET is a breeze and as a quick example, this is what you need to get inline editing going with very little effort at all.
You will need:
jQuery
jEditable
First the .aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>Untitled Page</title>
<script src="jquery.js" type="text/javascript"></script>
<script src="jeditable.js" type="text/javascript"></script>
<script type="text/javascript">$(document).ready(
function(){ $("p").editable( "http://localhost:3684/test/handler.ashx", { type: 'textarea',cancel: 'Cancel',indicator:"test.jpg", submit:'ok'});
});</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<p>yes you are now rocking with the best</p>
</form>
</body>
</html>
and you will need a httphandler to save the edits. For this example, I’m just writing the data back out without storing it.
And that’s it. Inline editing with jQuery and ASP.NET. Simple!
PS if you want to know why there has not been much action on the blog this month, blame this.
