<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rajeesh&#039;s Blog &#187; JQuery</title>
	<atom:link href="http://www.rajeeshcv.com/category/javascript/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rajeeshcv.com</link>
	<description>Sharing my knowledge</description>
	<lastBuildDate>Sun, 18 Jul 2010 06:09:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Asp.Net MVC &#8211; Fluent Html helper for FlexiGrid</title>
		<link>http://www.rajeeshcv.com/2010/04/asp-net-mvc-fluent-html-helper-for-flexigrid/</link>
		<comments>http://www.rajeeshcv.com/2010/04/asp-net-mvc-fluent-html-helper-for-flexigrid/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 10:31:00 +0000</pubDate>
		<dc:creator>Rajeesh</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.rajeeshcv.com/2010/04/asp-net-mvc-fluent-html-helper-for-flexigrid/</guid>
		<description><![CDATA[There are so many free JQuery Grid plugins out there, in that I liked FlexiGrid just because of it’s look and style. In order to use it in your MVC application you may have to put the Javascript code into your view, which requires the property names of your model in order to generates the [...]]]></description>
			<content:encoded><![CDATA[<p>There are so many free JQuery Grid plugins out there, in that I liked <a title="FlexiGrid" href="http://flexigrid.info/" target="_blank">FlexiGrid</a> just because of it’s look and style. In order to use it in your MVC application you may have to put the Javascript code into your view, which requires the property names of your model in order to generates the Grid columns as well the search options etc… as everybody knows when you deal with hard coded string as the property names in any code, it is error prone. </p>
<p>In order to avoid this problem I thought of creating a html extension which is tightly coupled with your data that is going to bound to the Grid. Which helps the developer from writing any javascript codes(I know those who hates(not me! <img src='http://www.rajeeshcv.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) writing Javascript code like this extension).</p>
<p>This project has been uploaded to &#8211; <a href="http://code.google.com/p/mvc-fluent-jquery-plugin-controls/">http://code.google.com/p/mvc-fluent-jquery-plugin-controls/</a>. You could find more details from there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rajeeshcv.com/2010/04/asp-net-mvc-fluent-html-helper-for-flexigrid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQueryUI Datepicker in ASP.Net MVC</title>
		<link>http://www.rajeeshcv.com/2010/02/jqueryui-datepicker-in-asp-net-mvc/</link>
		<comments>http://www.rajeeshcv.com/2010/02/jqueryui-datepicker-in-asp-net-mvc/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 02:39:00 +0000</pubDate>
		<dc:creator>Rajeesh</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Datepicker]]></category>
		<category><![CDATA[JQueryUI]]></category>

		<guid isPermaLink="false">http://www.rajeeshcv.com/2010/02/jqueryui-datepicker-in-asp-net-mvc/</guid>
		<description><![CDATA[Technocrati code : M2U2PWSNTKW3 
Datepicker is nice and cool plugin for displaying the calendar with ease. It is very easy to use JQuery plugin, it comes as part of JQueryUI library, so if you want to use this – first download JQueryUI from http://jqueryui.com/download and also download JQuery(http://docs.jquery.com/Downloading_jQuery) if you haven’t done yet.
&#160;
For e.g. if [...]]]></description>
			<content:encoded><![CDATA[<p>Technocrati code : M2U2PWSNTKW3 </p>
<p>Datepicker is nice and cool plugin for displaying the calendar with ease. It is very easy to use JQuery plugin, it comes as part of JQueryUI library, so if you want to use this – first download JQueryUI from <a href="http://jqueryui.com/download">http://jqueryui.com/download</a> and also download JQuery(<a title="http://docs.jquery.com/Downloading_jQuery" href="http://docs.jquery.com/Downloading_jQuery">http://docs.jquery.com/Downloading_jQuery</a>) if you haven’t done yet.</p>
<p><a href="http://www.rajeeshcv.com/wp-content/uploads/2010/02/image.png" rel="lightbox"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="230" alt="image" src="http://www.rajeeshcv.com/wp-content/uploads/2010/02/image_thumb.png" width="270" border="0" /></a>&#160;</p>
<p>For e.g. if you have a form like one below</p>
<pre class="brush: xml;">&lt;% using(Html.BeginForm()){%&gt;
  &lt;fieldset&gt;
    &lt;legend&gt;Event Information&lt;/legend&gt;
     &lt;p&gt;
        &lt;label for=&quot;EventName&quot;&gt;Event Name:&lt;/label&gt;
        &lt;%= Html.TextBox(&quot;EventName&quot;)%&gt;
            &lt;/p&gt;
            &lt;p&gt;
            &lt;label for=&quot;StartDate&quot;&gt;Start Date:&lt;/label&gt;
            &lt;%= Html.TextBox(&quot;StartDate&quot;)%&gt;
            &lt;/p&gt;
            &lt;p&gt;
            &lt;label for=&quot;EndDate&quot;&gt;End Date:&lt;/label&gt;
            &lt;%= Html.TextBox(&quot;EndDate&quot;)%&gt;
            &lt;/p&gt;
            &lt;p&gt;
                &lt;input type=&quot;submit&quot; value=&quot;Save&quot; /&gt;
            &lt;/p&gt;
  &lt;/fieldset&gt;
&lt;% }%&gt;</pre>
<p>and you want to attach datepicker to “StartDate” and “EndDate” input fields,</p>
</p>
<p><span id="more-162"></span></p>
<p>what you needs to do is call the datepicker function on the these input field selector like below.</p>
<pre class="brush: js;">&lt;script language=&quot;javascript&quot;&gt;
    $(document).ready(function() {
    $('#StartDate').datepicker();
    $('#EndDate').datepicker();
    });
&lt;/script&gt;</pre>
<p>This works fine as we expected <img src='http://www.rajeeshcv.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong><u>Difference in Date format patterns</u></strong></p>
<p>Consider a scenario where your MVC application supports localization, then the selected date displayed in the input fields also should display the in the same date format of the current culture(This format could be custom one or default one). This leads to you another issue – Datepicker plugin given by the JQueryUI supports different date formats, but it is different from one that is available in .NET. For e.g. in order to display a long day name (“Thursday”) .NET uses “<strong>dddd</strong>” its equivalent in Datepicker is “<strong>DD”</strong>.</p>
<p>In order to solve this disparity between the .NET world and Datepicker world, I have created a html helper function, which could generate the Datepicker format from a .Net date format.</p>
<pre class="brush: csharp;">/// &lt;summary&gt;
/// JQuery UI DatePicker helper.
/// &lt;/summary&gt;
public static class JQueryUIDatePickerHelper
{
    /// &lt;summary&gt;
    /// Converts the .net supported date format current culture format into JQuery Datepicker format.
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;html&quot;&gt;HtmlHelper object.&lt;/param&gt;
    /// &lt;returns&gt;Format string that supported in JQuery Datepicker.&lt;/returns&gt;
    public static string ConvertDateFormat(this HtmlHelper html)
    {
        return ConvertDateFormat(html, Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern);
    }

    /// &lt;summary&gt;
    /// Converts the .net supported date format current culture format into JQuery Datepicker format.
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;html&quot;&gt;HtmlHelper object.&lt;/param&gt;
    /// &lt;param name=&quot;format&quot;&gt;Date format supported by .NET.&lt;/param&gt;
    /// &lt;returns&gt;Format string that supported in JQuery Datepicker.&lt;/returns&gt;
    public static string ConvertDateFormat(this HtmlHelper html, string format)
    {
        /*
         *  Date used in this comment : 5th - Nov - 2009 (Thursday)
         *
         *  .NET    JQueryUI        Output      Comment
         *  --------------------------------------------------------------
         *  d       d               5           day of month(No leading zero)
         *  dd      dd              05          day of month(two digit)
         *  ddd     D               Thu         day short name
         *  dddd    DD              Thursday    day long name
         *  M       m               11          month of year(No leading zero)
         *  MM      mm              11          month of year(two digit)
         *  MMM     M               Nov         month name short
         *  MMMM    MM              November    month name long.
         *  yy      y               09          Year(two digit)
         *  yyyy    yy              2009        Year(four digit)             *
         */

        string currentFormat = format;

        // Convert the date
        currentFormat = currentFormat.Replace(&quot;dddd&quot;, &quot;DD&quot;);
        currentFormat = currentFormat.Replace(&quot;ddd&quot;, &quot;D&quot;);

        // Convert month
        if (currentFormat.Contains(&quot;MMMM&quot;))
        {
            currentFormat = currentFormat.Replace(&quot;MMMM&quot;, &quot;MM&quot;);
        }
        else if (currentFormat.Contains(&quot;MMM&quot;))
        {
            currentFormat = currentFormat.Replace(&quot;MMM&quot;, &quot;M&quot;);
        }
        else if (currentFormat.Contains(&quot;MM&quot;))
        {
            currentFormat = currentFormat.Replace(&quot;MM&quot;, &quot;mm&quot;);
        }
        else
        {
            currentFormat = currentFormat.Replace(&quot;M&quot;, &quot;m&quot;);
        }

        // Convert year
        currentFormat = currentFormat.Contains(&quot;yyyy&quot;) ? currentFormat.Replace(&quot;yyyy&quot;, &quot;yy&quot;) : currentFormat.Replace(&quot;yy&quot;, &quot;y&quot;);

        return currentFormat;
    }
}</pre>
<p>So how we could make use this helper method, just replace the datepicker initialization code we have written earlier with this</p>
<pre class="brush: xml;">&lt;script language=&quot;javascript&quot;&gt;
    $(document).ready(function() {
    $('#StartDate').datepicker({ dateFormat: '&lt;%= Html.ConvertDateFormat() %&gt;' });
    $('#EndDate').datepicker({ dateFormat: '&lt;%= Html.ConvertDateFormat() %&gt;' });
    });
&lt;/script&gt;</pre>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rajeeshcv.com/2010/02/jqueryui-datepicker-in-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inline editing using JQuery</title>
		<link>http://www.rajeeshcv.com/2009/06/inline-editing-using-jquery/</link>
		<comments>http://www.rajeeshcv.com/2009/06/inline-editing-using-jquery/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 00:29:21 +0000</pubDate>
		<dc:creator>Rajeesh</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.rajeeshcv.com/2008/07/inline-editing-using-jquery/</guid>
		<description><![CDATA[A post I forgot to publish which I wrote an year back
Here I wanted to show you the flexibility of JQuery.
Below is a HTML code that generates a grid with two rows and ten columns.
&#60;div&#62;

&#60;div&#62;1&#60;/div&#62;
&#60;div&#62;2&#60;/div&#62;
&#60;div&#62;3&#60;/div&#62;
&#60;div&#62;4&#60;/div&#62;
&#60;div&#62;5&#60;/div&#62;
&#60;div&#62;6&#60;/div&#62;
&#60;div&#62;7&#60;/div&#62;
&#60;div&#62;8&#60;/div&#62;
&#60;div&#62;9&#60;/div&#62;
&#60;div&#62;10&#60;/div&#62;

&#60;div&#62;11&#60;/div&#62;
&#60;div&#62;12&#60;/div&#62;
&#60;div&#62;13&#60;/div&#62;
&#60;div&#62;14&#60;/div&#62;
&#60;div&#62;15&#60;/div&#62;
&#60;div&#62;16&#60;/div&#62;
&#60;div&#62;17&#60;/div&#62;
&#60;div&#62;18&#60;/div&#62;
&#60;div&#62;19&#60;/div&#62;
&#60;div&#62;20&#60;/div&#62;

&#60;/div&#62;
When the user double clicks on any of the cell, he can edit that content. The cell value get updated when [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>A post I forgot to publish which I wrote an year back</p></blockquote>
<p>Here I wanted to show you the flexibility of JQuery.</p>
<p>Below is a HTML code that generates a grid with two rows and ten columns.<span id="more-48"></span></p>
<pre class="HTML" name="code">&lt;div&gt;

&lt;div&gt;1&lt;/div&gt;
&lt;div&gt;2&lt;/div&gt;
&lt;div&gt;3&lt;/div&gt;
&lt;div&gt;4&lt;/div&gt;
&lt;div&gt;5&lt;/div&gt;
&lt;div&gt;6&lt;/div&gt;
&lt;div&gt;7&lt;/div&gt;
&lt;div&gt;8&lt;/div&gt;
&lt;div&gt;9&lt;/div&gt;
&lt;div&gt;10&lt;/div&gt;

&lt;div&gt;11&lt;/div&gt;
&lt;div&gt;12&lt;/div&gt;
&lt;div&gt;13&lt;/div&gt;
&lt;div&gt;14&lt;/div&gt;
&lt;div&gt;15&lt;/div&gt;
&lt;div&gt;16&lt;/div&gt;
&lt;div&gt;17&lt;/div&gt;
&lt;div&gt;18&lt;/div&gt;
&lt;div&gt;19&lt;/div&gt;
&lt;div&gt;20&lt;/div&gt;

&lt;/div&gt;</pre>
<p>When the user double clicks on any of the cell, he can edit that content. The cell value get updated when user double clicks on any other cell.</p>
<p><a href="http://labs.rajeeshcv.com/inlineediting/index.html" target="_blank">Visit here</a> to see the demo.</p>
<pre class="jscript"  name="code">$(document).ready(function(){
$("div.column").dblclick(function(){ 

var content = $(this).text();
var width = $(this).width() -1;
var height = $(this).height() - 4;

var $editbox = $("&lt;input type='text'" +
"style='width:" + width + ";" +
"height:" + height + ";" +
"border:none" +
"' value='" +  content + "' /&gt;"); 

$(this).empty();
$(this).prepend($editbox);
$editbox.focus();
$editbox.select();

$($editbox).bind("blur",function(){                     

content = $(this).val();
var parent = $(this).parent();
parent.html(content); 

});

});

});</pre>
<p>The above code does all the trick.</p>
<p>First we hook the &#8220;Double Click&#8221; event to all the DIV with class name &#8220;column&#8221; using this</p>
<p>$(&#8220;div.column&#8221;).dblclick(function(){&#8230;});</p>
<p>Inside that, we dynamically add a textbox inside the DIV and set its text value as the HTML content of the parent DIV. And also we bind the &#8220;blur&#8221; event of this texbox to a function, so that whenever the focus leaves from the textbox, that function is called.</p>
<pre class="jscript"  name="code">$($editbox).bind("blur",function(){

content = $(this).val();
var parent = $(this).parent();
parent.html(content);

});</pre>
<p>inside that function, we set the HTML content of the DIV with the Textbox value.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rajeeshcv.com/2009/06/inline-editing-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery in asp.net</title>
		<link>http://www.rajeeshcv.com/2008/09/jquery-in-aspnet/</link>
		<comments>http://www.rajeeshcv.com/2008/09/jquery-in-aspnet/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 19:17:47 +0000</pubDate>
		<dc:creator>Rajeesh</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.rajeeshcv.com/?p=59</guid>
		<description><![CDATA[A good news for the  JQuery lovers like me; Scott Guthrie anounced that JQuery will be shipped along with Visual Studio and Microsoft is planning to use this excellent javascript library in their future control release.
]]></description>
			<content:encoded><![CDATA[<p>A good news for the  <a href="http://www.jquery.com" target="_blank">JQuery</a> lovers like me; <a href="http://weblogs.asp.net/scottgu" target="_blank"><span style="font-family: Arial; font-size: x-small;">Scott Guthrie</span></a> anounced that JQuery will be shipped along with Visual Studio and Microsoft is planning to use this excellent javascript library in their future control release.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rajeeshcv.com/2008/09/jquery-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
