<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-796466946303904267</id><updated>2012-02-02T09:00:33.709-08:00</updated><category term='Data Binding'/><category term='Json'/><category term='jsTree'/><category term='VB.NET'/><category term='XML'/><category term='jQuery'/><category term='UpdatePanel'/><category term='Ajax'/><category term='ASP.NET MVC'/><category term='GridView'/><category term='ASP.NET'/><title type='text'>Mohyuddin's Blog</title><subtitle type='html'>Intuitively to the point!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mohyuddin.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mohyuddin.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mahr G. Mohyuddin</name><uri>http://www.blogger.com/profile/11261291055128478260</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_kgf4jf6cd8w/SowwKDWbJ1I/AAAAAAAAAI0/ws-U9HfQvYU/S220/3a26081a-59e8-479c-81bd-7055f937dac4_100_100.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-796466946303904267.post-7575281714754972515</id><published>2009-08-15T11:46:00.001-07:00</published><updated>2009-08-15T12:51:45.629-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Binding'/><title type='text'>Dynamically Templated GridView with Edit, Delete and Insert Options ( VB.NET Version)</title><content type='html'>&lt;p&gt;Quite a while back I wrote an article titled &lt;a href="http://aspalliance.com/1125_Dynamically_Templated_GridView_with_Edit_Delete_and_Insert_Options.all" target="_blank"&gt;“Dynamically Templated GridView with Edit, Delete and Insert Options”&lt;/a&gt; on aspalliance.com in which I provided complete solution to build a GridView with template fields generated at run time with in-place Insert, Delete and Edit operations. I also gave complete description to implement ITemplate interface effectively. Before writing this article I googled a lot for such a solution for my university project but I could not find any, then I had to go for my own form scratch. When I came up with this and used it in my project successfully I thought to share it with complete description. &lt;/p&gt;&lt;p&gt;During this period where I received lot of appreciation mails for providing this ready to use piece of functionality, I also got many mails for its VB.NET version but unfortunately I could not find time to do so. Now I have converted it into VB.NET and have also done small refactoring for ADO.NET logic.&amp;#160; You can download both versions from following links.&lt;/p&gt;&lt;br /&gt;
&lt;h5&gt;&lt;a title="Dynamically Templated GridView with Edit, Delete and Insert Options (VB.NET )" href="http://cid-bc187c3441146295.skydrive.live.com/self.aspx/Public/Blog/DynamicallyTemplatedGridView/DynamicallyTemplatedGridViewSample-VBNET.rar" target="_blank"&gt;Download VB.NET Version&lt;/a&gt;&lt;/h5&gt;&lt;h5&gt;&lt;a title="Dynamically Templated GridView with Edit, Delete and Insert Options (C#)" href="http://cid-bc187c3441146295.skydrive.live.com/self.aspx/Public/Blog/DynamicallyTemplatedGridView/DynamicallyTemplatedGridViewSample-CSharp.rar" target="_blank"&gt;Download C-Sharp Version&lt;/a&gt;&lt;/h5&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/796466946303904267-7575281714754972515?l=mohyuddin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mohyuddin.blogspot.com/feeds/7575281714754972515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mohyuddin.blogspot.com/2009/08/dynamically-templated-gridview-with.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/7575281714754972515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/7575281714754972515'/><link rel='alternate' type='text/html' href='http://mohyuddin.blogspot.com/2009/08/dynamically-templated-gridview-with.html' title='Dynamically Templated GridView with Edit, Delete and Insert Options ( VB.NET Version)'/><author><name>Mahr G. Mohyuddin</name><uri>http://www.blogger.com/profile/11261291055128478260</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_kgf4jf6cd8w/SowwKDWbJ1I/AAAAAAAAAI0/ws-U9HfQvYU/S220/3a26081a-59e8-479c-81bd-7055f937dac4_100_100.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-796466946303904267.post-1610860402939895563</id><published>2009-08-07T13:20:00.001-07:00</published><updated>2009-08-09T12:11:19.575-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Json'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET MVC'/><category scheme='http://www.blogger.com/atom/ns#' term='jsTree'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Binding'/><title type='text'>Persisting jsTree changes in Database</title><content type='html'>&lt;p&gt;In my &lt;a href="http://mohyuddin.blogspot.com/2009/06/binding-jstree-with-database-in-aspnet.html" target="_blank"&gt;last posts&lt;/a&gt; I demonstrated how you can bind&amp;#160; jsTree with&amp;#160; database in ASP.NET MVC. In this post I'll&amp;#160; demonstrate following actions on jsTree nodes and save the changes in database in ASP.NET MVC.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Moving a node/Changing order (changing employee’s manager) &lt;/li&gt;
&lt;li&gt;Adding a new node (adding new employee under a manager) &lt;/li&gt;
&lt;li&gt;Renaming a node (Changing name of an employee) &lt;/li&gt;
&lt;li&gt;Deleting a node (Removing an employee from the hierarchy) &lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Please note that jsTree has “callback” option attribute to define the callbacks required to achieve these tasks. It exposes several callbacks which can be used as per needed. Here are the different callbacks we’ll have to implement.&lt;/p&gt;&lt;pre class="brush:js"&gt;$("#empgraph").tree({
        data: {
            type: "json",
            url: "/Home/GetHiearchicalNodesInfo",
            async: true
        },
        rules: {
            //ommitted for brevity
        },
        callback: {  //skeleton of all required callbacks
             onmove: function(NODE, REF_NODE, TYPE, TREE_OBJ, RB) { },
             oncreate: function(NODE, REF_NODE, TYPE, TREE_OBJ, RB) { },
             ondelete: function(NODE, TREE_OBJ, RB) { }
             onrename: function(NODE, LANG, TREE_OBJ, RB) { }
        }
 });
&lt;/pre&gt;&lt;p&gt;Before implementing these callbacks we should know what information we require to be sent to server to perform these actions. Lets have a look on these actions one by one.&lt;/p&gt;&lt;h4&gt;Moving Nodes/Changing Order of Nodes&lt;/h4&gt;&lt;br /&gt;
&lt;a href="http://lh5.ggpht.com/_kgf4jf6cd8w/SnyMSkM-WMI/AAAAAAAAAF0/uPIrbPUV7ls/s1600-h/image%5B2%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="244" alt="image" src="http://lh6.ggpht.com/_kgf4jf6cd8w/SnyMV14ObqI/AAAAAAAAAF4/SRW0wspvhFY/image_thumb.png?imgmax=800" width="185" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;To save the changed hiearchy we need node’s id and its parent’s id. onmove call back has several arguments , three of which NODE , REF_NODE and&amp;#160; TYPE are important to note, NODE has the reference of the moving node, REF_NODE is the one&amp;#160; it is moving toward. When TYPE will be “inside”, REF_NODE will be its parent node. Lets implement this.&lt;/p&gt;&lt;pre class="brush:js"&gt;onmove: function(NODE, REF_NODE, TYPE, TREE_OBJ, RB) {
    var parent_id = 0;

    if (TYPE === "inside") {
        parent_id = $(REF_NODE).attr('id');
    }
       saveHiearchy(NODE.id, parent_id);
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;After getting child (node) id and parent, simply call a method that could make a POSt request on sever to save this changed information in database. &lt;/p&gt;&lt;br /&gt;
&lt;pre class="brush:js"&gt;function saveHiearchy(node_id, parent_id) {
    var actionUrl = "/Home/SaveHiearchy?childId=" + node_id + "&amp;parentId=" + parent_id;
    $.ajax(
        {
            type: "POST",
            url: actionUrl,
            data: null,
            dataType: "json",
            success: function(data) {
            },
            error: function(req, status, error) {
            }
        });
}  
&lt;/pre&gt;&lt;br /&gt;
&lt;h4&gt;Adding a new node&lt;/h4&gt;&lt;a href="http://lh6.ggpht.com/_kgf4jf6cd8w/SnyMWw3a_hI/AAAAAAAAAF8/h0UgcMaymHs/s1600-h/image%5B8%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="244" alt="image" src="http://lh3.ggpht.com/_kgf4jf6cd8w/SnyMbyxbHKI/AAAAAAAAAGA/d_BlK9tOeg4/image_thumb%5B2%5D.png?imgmax=800" width="198" border="0" /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;To create a node we need node’s parent’s id and the name of the node. &lt;em&gt;oncreate &lt;/em&gt;callback also has the same arguments as onmove had, in this case hwe again require NODE , REF_NODE and TYPE&amp;#160; to create a new node as the following code shows.&lt;/p&gt;&lt;pre class="brush:js"&gt;oncreate: function(NODE, REF_NODE, TYPE, TREE_OBJ, RB) {
    var parent_id = 0;

    if (TYPE === "inside") {
        parent_id = $(REF_NODE).attr('id');
    }
    createNode(NODE, parent_id);
}&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;It is interesting to note when you when you’ll create a node, oncreate will fire and a node with name “New Folder” will be created in database. When you will enter your required name , the onrename will be called to update the previously saved name.. But to achieve this we have to send the newly created node’s id from server back to client and on onsuccess of&amp;#160; oncreate callback we have to save this id in some global variable to be used in rename callback; createdNodeId&amp;#160; is being assigned the id. Please note createNode node method gets the name associated with the node and passes the information to server. &lt;/p&gt;&lt;br /&gt;
&lt;pre class="brush:js"&gt;function createNode(NODE, parentId) {
    var folderName = $(NODE.innerHTML).filter("a")[0].innerText;
    var actionUrl = "/Home/CreateFolder?folderName=" + folderName + "&amp;parentId=" + parentId;
    $.ajax(
        {
            type: "POST",
            url: actionUrl,
            data: null,
            dataType: "json",
            success: function(data) {
                createdNodeId = data.nodeId;
            },
            error: function(req, status, error) {
            }
        });
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;Renaming a node&lt;/h4&gt;&lt;a href="http://lh5.ggpht.com/_kgf4jf6cd8w/SnyMdPWQvPI/AAAAAAAAAGE/SEKlq9GBXu0/s1600-h/image%5B5%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="244" alt="image" src="http://lh6.ggpht.com/_kgf4jf6cd8w/SnyMfiLfz_I/AAAAAAAAAGI/6LJMztrPt4o/image_thumb%5B1%5D.png?imgmax=800" width="183" border="0" /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Renaming a node requires its id and the changed name. This information can be available as shown below.&lt;/p&gt;&lt;br /&gt;
&lt;pre class="brush:js"&gt;onrename: function(NODE, LANG, TREE_OBJ, RB) {
    renameNode(NODE.id, $(NODE.innerHTML).filter("a")[0].innerText);
  }&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Since this method also gets called when a new node is created; it is the case when node id is empty so use the createdNodeId otherwise it will have node id.&lt;/p&gt;&lt;pre class="brush:js"&gt;function renameNode(nodeId, nodeNewTitle) {
    if ($.trim(nodeId) == "")
    nodeId = createdNodeId;

    var actionUrl = "/Home/RenameNode?nodeId=" + nodeId + "&amp;nodeNewTitle=" + nodeNewTitle;
    $.ajax(
        {
            type: "POST",
            url: actionUrl,
            data: null,
            dataType: "json",
            success: function(data) {
            },
            error: function(req, status, error) {
            }
        });
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;Deleting a node&lt;/h4&gt;&lt;a href="http://lh3.ggpht.com/_kgf4jf6cd8w/SnyMg2VDy0I/AAAAAAAAAGM/cjy7BpPmg1g/s1600-h/image%5B11%5D.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="244" alt="image" src="http://lh3.ggpht.com/_kgf4jf6cd8w/SnyMixtz_lI/AAAAAAAAAGQ/OXhgoW4x5iY/image_thumb%5B3%5D.png?imgmax=800" width="203" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Deleting a node is the simplest case, in this case we just need id of the node to be deleted. &lt;/p&gt;&lt;pre class="brush:js"&gt;ondelete: function(NODE, TREE_OBJ, RB) {
            deleteSubNode(NODE.id);
        }
&lt;/pre&gt;&lt;p&gt;The related ajax routine &lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:js"&gt;function deleteSubNode(nodeId) {
    var actionUrl = "/Home/DeleteSubNode?folderId=" + nodeId;
    $.ajax(
    {
        type: "POST",
        url: actionUrl,
        data: null,
        dataType: "json",
        success: function(data) {
        },
        error: function(req, status, error) {
        }
    });
}&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;Here is the complete jsTree code, with callbacks implemented.&lt;/p&gt;&lt;pre class="brush:js"&gt;$("#empgraph").tree({
            data: {
                type: "json",
                url: "/Home/GetHiearchicalNodesInfo",
                async: true
            },
            ui: { theme_name: "classic" },
            rules: {
                metadata: "mdata",
                use_inline: true,
                clickable: ["all"],
                deletable: ["all"],
                renameable: ["all"],
                creatable: ["all"],
                draggable: ["all"],
                // dragrules: ["child * child", "child inside root", "tree-drop inside root"],
                createat: ["top"],
                drag_button: "left",
                droppable: ["tree-drop"]
            },

            callback: {

                onmove: function(NODE, REF_NODE, TYPE, TREE_OBJ, RB) {
                    var parent_id = 0;

                    if (TYPE === "inside") {
                        parent_id = $(REF_NODE).attr('id');
                    }
                    saveHiearchy(NODE.id, parent_id);
                },
                onrename: function(NODE, LANG, TREE_OBJ, RB) {
                    renameNode(NODE.id, $(NODE.innerHTML).filter("a")[0].innerText);
                },
                oncreate: function(NODE, REF_NODE, TYPE, TREE_OBJ, RB) {
                    var parent_id = 0;

                    if (TYPE === "inside") {
                        parent_id = $(REF_NODE).attr('id');
                    }
                    createNode(NODE, parent_id);
                },
                ondelete: function(NODE, TREE_OBJ, RB) {
                    deleteSubNode(NODE.id);
                }
            }
        });
&lt;/pre&gt;&lt;p&gt;Here are the corresponding controller actions, they can be implemented with your own data access layer or LINQ or any type ORM. &lt;/p&gt;&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;public ActionResult SaveHiearchy(string childId, string parentId)
{
    JsTreeDAO.SaveNodeRelationship(childId,parentId);

    return null; //you may return any success flag etc
}
 public ActionResult RenameNode(string nodeId, string nodeNewTitle)
 {
     JsTreeDAO.RenameNode(nodeId, nodeNewTitle);

     return null; //you may return any success flag etc
 }

 public JsonResult CreateFolder(string folderName, string parentId)
 {
     int newNodeId = JsTreeDAO.AddSubNode(parentId, folderName);

     return Json(new { nodeId = newNodeId });//id of newly created node is required for rename callback.
 }

 public ActionResult DeleteSubNode(string folderId)
 {
     JsTreeDAO.DeleteSubNode(folderId);

     return null; //you may return any success flag etc
 }
&lt;/pre&gt;&lt;p&gt;Please note that I have not provided the details of the DAO class being used here and also have not used LINQ in these examples just to keep things simple because LINQ does not have direct equivalent for &amp;quot;Hierarchy&amp;quot; common table expression, otherwise we would have to resort to LINQ extensions. &lt;/p&gt;&lt;p&gt;Hope this helps. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/796466946303904267-1610860402939895563?l=mohyuddin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mohyuddin.blogspot.com/feeds/1610860402939895563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mohyuddin.blogspot.com/2009/08/persisting-jstree-changes-to-database.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/1610860402939895563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/1610860402939895563'/><link rel='alternate' type='text/html' href='http://mohyuddin.blogspot.com/2009/08/persisting-jstree-changes-to-database.html' title='Persisting jsTree changes in Database'/><author><name>Mahr G. Mohyuddin</name><uri>http://www.blogger.com/profile/11261291055128478260</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_kgf4jf6cd8w/SowwKDWbJ1I/AAAAAAAAAI0/ws-U9HfQvYU/S220/3a26081a-59e8-479c-81bd-7055f937dac4_100_100.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_kgf4jf6cd8w/SnyMV14ObqI/AAAAAAAAAF4/SRW0wspvhFY/s72-c/image_thumb.png?imgmax=800' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-796466946303904267.post-8962043068065124308</id><published>2009-06-29T15:16:00.001-07:00</published><updated>2009-08-09T12:11:19.575-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Json'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET MVC'/><category scheme='http://www.blogger.com/atom/ns#' term='jsTree'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Binding'/><title type='text'>Binding JsTree with Database in ASP.NET MVC</title><content type='html'>&lt;p&gt;In my&amp;#160; &lt;a title="Binding jsTree programmatically with server side entities using JSON in ASP.NET" href="http://mohyuddin.blogspot.com/2009/05/binding-jstree-programmatically-with.html" target="_blank"&gt;previous post&lt;/a&gt; I demonstrated how to bind jsTree programmatically with a collection/array of objects using JSON. In this post I’ll reuse the same logic to map jsTree node anatomy on server side entity and will populate that entities from database. That , in turn will be converted to JSON and sent to client side to bind with jsTree. I’ll demonstrate this in ASP.NET MVC. &lt;/p&gt;&lt;p&gt;First you need to setup jsTree with required files in your ASP.NET MVC project as shown below .&lt;/p&gt;&lt;p&gt;&amp;#160;&lt;a href="http://lh5.ggpht.com/_kgf4jf6cd8w/Skk9O7cgk8I/AAAAAAAAAFM/3H_ay7zwE0Q/s1600-h/image13.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="305" alt="image" src="http://lh5.ggpht.com/_kgf4jf6cd8w/Skk9S2hgOKI/AAAAAAAAAFQ/de7846l5mIA/image_thumb5.png?imgmax=800" width="189" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I’ll bind jsTree with a self referencing table for example an Employee, where an employee can also be manager of another employee. To keep it as simplest as possible there are only three fields in the table , ID . Name and ManagerId as shown below.&lt;/p&gt;&lt;p&gt;&lt;a href="http://lh3.ggpht.com/_kgf4jf6cd8w/Skk9Tv6_HVI/AAAAAAAAAFU/sxSW9HjnChs/s1600-h/image16.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="169" alt="image" src="http://lh6.ggpht.com/_kgf4jf6cd8w/Skk9UlRKuDI/AAAAAAAAAFY/6kpKWs47RbU/image_thumb6.png?imgmax=800" width="234" border="0" /&gt;&lt;/a&gt;Here is sample data in the table to be displayed. You can see from the data the table is self referencing i.e.&amp;#160; ManagerId of an employee is ID of another employee&lt;/p&gt;&lt;p&gt;&amp;#160; &lt;a href="http://lh5.ggpht.com/_kgf4jf6cd8w/Sko7WYshaQI/AAAAAAAAAFk/xe-9LichTfM/s1600-h/image%5B11%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="262" alt="image" src="http://lh4.ggpht.com/_kgf4jf6cd8w/Sko7XW74BdI/AAAAAAAAAFo/N3tpn69u0lU/image_thumb%5B5%5D.png?imgmax=800" width="252" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;With bottom up approach next step is to setup Model with a method that could return a DataSet&amp;#160; to the controller action. I am not using LINQ in this post , I have added a class named jsTreeDAO in the model that uses ConnectionManager, a utility class for data access&amp;#160;. I am not showing its definition here. Its quite simple to implement, you can also wirte your own ADO logic in the method.&lt;/p&gt;&lt;pre class="brush:csharp"&gt;public static DataSet GetEmployeeHiearchicalInfo()
  {
    DataSet ds = new DataSet();
    try
    {
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = @"WITH Hierarchy(ManagerId, EmpId, level, Name) AS (
            SELECT ManagerId, Id, 0, Name FROM Employee
            where ManagerId Is Null UNION ALL SELECT dt.ManagerId, dt.Id, level + 1, dt.Name FROM Employee 
            dt INNER JOIN hierarchy h ON dt.ManagerId = h.EmpId) 
            select * from Hierarchy";

        cmd.CommandType = CommandType.Text;
        //ConnectionManager is a utility class written for handling connection and exectue commands.
        ConnectionManager.Execute(cmd, ref ds);
    }
    catch (SqlException)
    {
        throw;
    }
    catch (Exception)
    {
        throw;
    }
    return ds;
 }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;The important point to note in above method is the SQL query&amp;#160; which uses Common Table Expression (CTE)&amp;#160; a new feature in SQL Server 2005 for building an hierarchal view of&amp;#160; the data. For more details about CTE ,please refer to &lt;a title="Common Table Expressions (CTE) in SQL Server 2005/2008/2010" href="http://www.4guysfromrolla.com/webtech/071906-1.shtml" target="_blank"&gt;this article.&lt;/a&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;Lets Add a controller Action that&amp;#160; would call the model’s method. You need to add a controller first ,say its&amp;#160; EmployeeController add an Action with name GetEmployeesHiearchicaInfo as shown below.&lt;/p&gt;&lt;pre class="brush:csharp"&gt;public JsonResult GetEmployeeInfo()
  {
    DataSet dsNodes = JsTreeDAO.GetEmployeeHiearchicalInfo();
    DataTable tableNodes = dsNodes.Tables[0];
    DataRow parentDr = tableNodes.Rows[0];

    JsTreeNode rootNode = new JsTreeNode();
    rootNode.attributes = new Attributes();
    rootNode.attributes.id = Convert.ToString(parentDr["EmpId"]);
    rootNode.attributes.rel = "root" + Convert.ToString(parentDr["EmpId"]);
    rootNode.data = new Data();
    rootNode.data.title = Convert.ToString(parentDr["Name"]);

    rootNode.attributes.mdata = "{ draggable : true, max_children : 100, max_depth : 100 }";

    PopulateTree(parentDr, rootNode, tableNodes);


    return Json(rootNode);
  }
&lt;/pre&gt;&lt;br /&gt;
&lt;p&gt;This method is quite self explanatory. First it gets DataSet having employee info then it sets all info for the root node from the first data row, then it passes both rootNode and parentRow to another method that binds all info recursively for its children. The definition of method is shown below.&lt;/p&gt;&lt;pre class="brush:csharp"&gt;public void PopulateTree(DataRow dataRow, JsTreeNode jsTNode, DataTable tableNodes)
{
    jsTNode.children = new List&lt;jstreenode&gt;();
    foreach (DataRow dr in tableNodes.Rows)
    {

        if (dr != null)
        {
            if (Convert.ToInt32(dr["level"]) == Convert.ToInt32(dataRow["level"]) + 1
                        &amp;&amp; Convert.ToInt32(dr["ManagerId"]) == Convert.ToInt32(dataRow["EmpId"])
                        )
            {

                JsTreeNode cnode = new JsTreeNode();
                cnode.attributes = new Attributes();
                cnode.attributes.id = Convert.ToString(dr["EmpId"]);
                cnode.attributes.rel = "folder" + Convert.ToString(dr["EmpId"]);
                cnode.data = new Data();
                cnode.data.title = Convert.ToString(dr["Name"]);

                cnode.attributes.mdata = "{ draggable : true, max_children : 100, max_depth : 100 }";

                jsTNode.children.Add(cnode);


                PopulateTree(dr, cnode, tableNodes);

            }
        }
    }
}
&lt;/pre&gt;&lt;p&gt;Now we have to add a view named Employee to display employee information coming from database using jsTree. The View&amp;#160; markup is quite simple just add a div to which you want to attach the jsTree as shown below.&lt;/p&gt;&lt;pre class="brush:html"&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; MasterPageFile=&amp;quot;~/Views/Shared/Site.Master&amp;quot; Inherits=&amp;quot;System.Web.Mvc.ViewPage&amp;quot; %&amp;gt;
&amp;lt;asp:Content ID=&amp;quot;aboutTitle&amp;quot; ContentPlaceHolderID=&amp;quot;TitleContent&amp;quot; runat=&amp;quot;server&amp;quot;%&amp;gt;
Employee Graph
&amp;lt;/asp:Content&amp;gt;
&amp;lt;asp:Content ID=&amp;quot;aboutContent&amp;quot; ContentPlaceHolderID=&amp;quot;MainContent&amp;quot; runat=&amp;quot;server&amp;quot;%&amp;gt;
&amp;lt;div id=&amp;quot;employeeGraph&amp;quot; %&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/asp:Content%&amp;gt;
&lt;/pre&gt;&lt;p&gt;Now we have to setup jsTree which will call the controller method asynchronously to load and bind data as shown below.&lt;/p&gt;&lt;br /&gt;
&lt;pre class="brush:js"&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
$(function() {
    $("#foldergraph").tree({
        data: {
            type: "json",
            url: "/Home/GetEmployeeInfo",
            async: true
        },
        ui: { theme_name: "classic" },
        rules: {
            metadata: "mdata",
            use_inline: true,
            clickable: ["all"],
            deletable: ["all"],
            renameable: ["all"],
            creatable: ["all"],
            draggable: ["all"],
            dragrules: ["child * child", "child inside root", "tree-drop inside root"],
            createat: ["top"],
            drag_button: "left",
            droppable: ["tree-drop"]
        }

    });
});

&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;p&gt;Its also mentioned in my last post that the rules{} configuration is optional, only you have to set data aggregate attributes of the jsTree . &lt;br /&gt;
&lt;br /&gt;
must need to set Async=true for asynchronous JSON data load form server.&lt;/p&gt;&lt;p&gt;Have a look on the output.&lt;/p&gt;&lt;p&gt;&lt;a href="http://lh3.ggpht.com/_kgf4jf6cd8w/Sko7YH4IDqI/AAAAAAAAAFs/UE0uAeiM-g0/s1600-h/image%5B15%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="263" alt="image" src="http://lh3.ggpht.com/_kgf4jf6cd8w/Sko7ZKbUISI/AAAAAAAAAFw/Gnxs9E37HLw/image_thumb%5B7%5D.png?imgmax=800" width="225" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;In these two&amp;#160; posts i just focused on only jsTree data binding, in upcoming posts I will show you how you can drag drop, create, delete nodes and persist the changes in database&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Mahr&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/796466946303904267-8962043068065124308?l=mohyuddin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mohyuddin.blogspot.com/feeds/8962043068065124308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mohyuddin.blogspot.com/2009/06/binding-jstree-with-database-in-aspnet.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/8962043068065124308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/8962043068065124308'/><link rel='alternate' type='text/html' href='http://mohyuddin.blogspot.com/2009/06/binding-jstree-with-database-in-aspnet.html' title='Binding JsTree with Database in ASP.NET MVC'/><author><name>Mahr G. Mohyuddin</name><uri>http://www.blogger.com/profile/11261291055128478260</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_kgf4jf6cd8w/SowwKDWbJ1I/AAAAAAAAAI0/ws-U9HfQvYU/S220/3a26081a-59e8-479c-81bd-7055f937dac4_100_100.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_kgf4jf6cd8w/Skk9S2hgOKI/AAAAAAAAAFQ/de7846l5mIA/s72-c/image_thumb5.png?imgmax=800' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-796466946303904267.post-5500831640300423306</id><published>2009-05-30T13:23:00.001-07:00</published><updated>2009-08-09T12:11:19.576-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Json'/><category scheme='http://www.blogger.com/atom/ns#' term='jsTree'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Binding'/><title type='text'>Binding jsTree programmatically with server side entities using JSON in ASP.NET</title><content type='html'>jsTree is very useful jQuery based javascript component for displaying contents&lt;br /&gt;
in tree structure in hierarchical manner. In this small example I’ll give you a&lt;br /&gt;
demonstration how you can bind jsTree programmatically with sever side data using&lt;br /&gt;
JSON.&lt;br /&gt;
Before going for implementation first have a look on the format of JSON input&lt;br /&gt;
to create nodes.&lt;br /&gt;
&lt;pre class="brush:js"&gt;json:  [   { attributes:  { id: "root1", rel: "root" }, 
        state: "open", data: "Root node 1", 
        children: [    { attributes: { id: "root1_child1", rel: "folder" }, 
         data: { title: "Custom icon", icon: "../images/ok.jpg" } 
      }, 
//.. . other nodes 
  ]&lt;/pre&gt;&lt;br /&gt;
And here is the entity based implementation of a jsTree node.&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

public class JsTreeNode
{
    public JsTreeNode()
    {
    }
    Attributes _attributes;
    public Attributes attributes
    {
        get
        {
            return _attributes;
        }
        set
        {
            _attributes = value;
        }
    }
    Data _data;
    public Data data
    {
        get
        {
            return _data;
        }
        set
        {
            _data = value;
        }
    }
    string _state;
    public string state
    {
        get
        {
            return _state;
        }
        set
        {
            _state = value;
        }
    }
    List&lt;jstreenode&gt; _children;
    public List&lt;jstreenode&gt; children
    {
        get
        {
            return _children;
        }
        set
        {
            _children = value;
        }
    }

}
public class Attributes
{
    string _id;

    public string id
    {
        get
        {
            return _id;
        }
        set
        {
            _id = value;
        }
    }
    string _rel;

    public string rel
    {
        get
        {
            return _rel;
        }
        set
        {
            _rel = value;
        }
    }
    string _mdata;

    public string mdata
    {
        get
        {
            return _mdata;
        }
        set
        {
            _mdata = value;
        }
    }
}

public class Data
{
    string _title;

    public string title
    {
        get
        {
            return _title;
        }
        set
        {
            _title = value;
        }
    }

    string _icon;

    public string icon
    {
        get
        {
            return _icon;
        }
        set
        {
            _icon = value;
        }
    }
}




&lt;/pre&gt;&lt;br /&gt;
As you can see the JSON , jsTree expects is collection nodes each having following&lt;br /&gt;
structure&lt;br /&gt;
&lt;pre class="brush:js" name="code"&gt;{  attributes: { id: "pjson1_5", rel: "root2" },  data: "Root node 2" }&lt;/pre&gt;&lt;br /&gt;
where state and children are optional fields to be set. Keeping the above anatomy&lt;br /&gt;
of jsTree node , we can creat server side class to have one-one mapping with these&lt;br /&gt;
json objects with composition/aggregation as&amp;nbsp; per needed so that we can bind&lt;br /&gt;
it with node collection populated from sever side. Lets create the main jsTreeNode&lt;br /&gt;
and other entities which compose its anatomy as shown above.&lt;br /&gt;
&amp;lt; The jsTreeNode is capable to fully map the jsTree json type node. And now its time to populate the jsTreeNode coollection bind the JsTree with it. &lt;br /&gt;
&lt;pre class="brush:csharp" name="code"&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RouteCallbacks();
        }
    }
    void RouteCallbacks()
    {
        string callback = Request.Params["callback"];
        if (string.IsNullOrEmpty(callback))
            return;

        if (callback == "GetNodesJson")
            this.GetNodesJson();
    }
    void GetNodesJson()
    {
        List&lt;jstreenode&gt; nodesList = new List&lt;jstreenode&gt;();
        for (int i = 1; i &lt; 10; i++)
        {
            JsTreeNode node = new JsTreeNode();
            node.attributes = new Attributes();
            node.attributes.id = "rootnod" + i;
            node.attributes.rel = "root" + i;
            node.data = new Data();
            node.data.title = "Root node:" + i;
            node.state = "open";

            node.children = new List&lt;JsTreeNode&gt;();

            for (int j = 1; j &lt; 4; j++)
            {
                JsTreeNode cnode = new JsTreeNode();
                cnode.attributes = new Attributes();
                cnode.attributes.id = "childnod1" + j;
                node.attributes.rel = "folder";
                cnode.data = new Data();
                cnode.data.title = "child node: " + j;
                cnode.attributes.mdata = "{draggable : true,max_children : 1,max_depth : 1 }";
                node.children.Add(cnode);

            }
            node.attributes.mdata = "{draggable : false,max_children : 1, max_depth :1}";
            nodesList.Add(node);
        }
        JavaScriptSerializer ser = new JavaScriptSerializer();
        string res = ser.Serialize(nodesList);
        Response.ContentType = "application/json";
        Response.Write(res);
        Response.End();
    }
}
 &lt;/pre&gt;
Following is the client side complete code snipet required to bind jsTree with the server side entities based JSON data. Please dont forget to add jQuery and jsTree related js files reference to your page. The "rule{}" configuration is optional. It is only required if you want your jsTree to be all ***able.

&lt;pre class="brush:js"&gt;&amp;lt;script type="text/javascript"&amp;gt;
      $(function() {
            $("#divJsTreeDemo").tree({
            data: {
            type: "json",
            url: "Default.aspx?callback=GetNodesJson",
            async: true

            },

            rules: {
            metadata: "mdata",
            use_inline: true,
            clickable: ["root2", "folder"],
            deletable: "none",
            renameable: "all",
            creatable: ["folder"],
            draggable: ["folder"],
            dragrules: ["folder * folder", "folder inside root", "tree-drop inside root2"],
            drag_button: "left",
            droppable: ["tree-drop"]

            }
          });

      });

    &amp;lt;/script&amp;gt;

&lt;/pre&gt;Following is the page markup.
&lt;pre class="brush:html" &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;form id="form1" runat="server"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div id="divJsTreeDemo"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/form&amp;gt;

&lt;/pre&gt;Here it is, Have a look.


&lt;a href="http://lh3.ggpht.com/_kgf4jf6cd8w/SiGVyD9hL3I/AAAAAAAAAFE/ijggROvOtCo/s1600-h/image%5B4%5D.png"&gt;
&lt;img alt="image" border="0" height="371" src="http://lh3.ggpht.com/_kgf4jf6cd8w/SiGV0zyWYBI/AAAAAAAAAFI/23josemUA4w/image_thumb%5B2%5D.png?imgmax=800" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" width="175" /&gt;&lt;/a&gt;


Hope this helps. For more about jsTree please visit its &lt;a href="http://jstree.com/"&gt;
website&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/796466946303904267-5500831640300423306?l=mohyuddin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mohyuddin.blogspot.com/feeds/5500831640300423306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mohyuddin.blogspot.com/2009/05/binding-jstree-programmatically-with.html#comment-form' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/5500831640300423306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/5500831640300423306'/><link rel='alternate' type='text/html' href='http://mohyuddin.blogspot.com/2009/05/binding-jstree-programmatically-with.html' title='Binding jsTree programmatically with server side entities using JSON in ASP.NET'/><author><name>Mahr G. Mohyuddin</name><uri>http://www.blogger.com/profile/11261291055128478260</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_kgf4jf6cd8w/SowwKDWbJ1I/AAAAAAAAAI0/ws-U9HfQvYU/S220/3a26081a-59e8-479c-81bd-7055f937dac4_100_100.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_kgf4jf6cd8w/SiGV0zyWYBI/AAAAAAAAAFI/23josemUA4w/s72-c/image_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-796466946303904267.post-3667847173925620959</id><published>2009-04-25T00:52:00.001-07:00</published><updated>2009-04-25T03:18:09.600-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET MVC'/><title type='text'>Uploading File in ASP.NET MVC</title><content type='html'>&lt;p class="MsoNormal"&gt;Uploading file in ASP.NET MVC is not as straight job as in ASP.NET as you have to do the ASP.NET FileUpload server control job yourself. You have to follow following simple steps. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; mso-fareast-font-family: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-list: ignore"&gt;&lt;strong&gt;1.&lt;/strong&gt;&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Set &lt;b style="mso-bidi-font-weight: normal"&gt;enctype&lt;/b&gt; property of the form to &lt;span style="font-size: 10pt; color: #a31515; font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&amp;quot;Multipart/form-data&amp;quot; &lt;/span&gt;as shown below. By default enctype of form is “&lt;span style="font-size: 10pt; color: blue; font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;application/x-www-form-urlencoded&amp;quot;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpLast" style="margin-bottom: 0pt; mso-add-space: auto; mso-layout-grid-align: none"&gt;&lt;a href="http://lh4.ggpht.com/_kgf4jf6cd8w/SfLBDzeGb2I/AAAAAAAAAEU/maQdXElWnQw/s1600-h/image%5B14%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="99" alt="image" src="http://lh4.ggpht.com/_kgf4jf6cd8w/SfLBFVsARvI/AAAAAAAAAEY/P3JVwkK6bqA/image_thumb%5B10%5D.png?imgmax=800" width="604" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p class="MsoListParagraphCxSpLast" style="margin-bottom: 0pt; mso-add-space: auto; mso-layout-grid-align: none"&gt;The page contains an input field of type “file” and button to submit the form.&lt;/p&gt;  &lt;p&gt;By adding setting enctype to &amp;quot;Multipart/form-data&amp;quot;, HTTP takes cares of the files uploaded before submission. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Add logic to grab the file in the controller that is being used to update the form say it’s “Edit”. When the form having enctype = &amp;quot;Multipart/form-data&amp;quot; is submitted the Request object will contain a collection of files, iterate this collection to get the desired file.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_kgf4jf6cd8w/SfLBGqggb0I/AAAAAAAAAEc/JKqXDdTwNJE/s1600-h/controller-fileupload%5B5%5D.png"&gt;&lt;img title="controller-fileupload" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="549" alt="controller-fileupload" src="http://lh5.ggpht.com/_kgf4jf6cd8w/SfLBI5InU6I/AAAAAAAAAEg/4lVSyqiO16A/controller-fileupload_thumb%5B5%5D.png?imgmax=800" width="604" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;That’s it. &lt;/p&gt;  &lt;p&gt;Just for your info you might have seen that the built in &lt;span style="font-size: 10pt; color: #2b91af; font-family: &amp;quot;Courier New&amp;quot;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;; mso-no-proof: yes; mso-fareast-theme-font: minor-fareast; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa"&gt;HttpPostedFileBase &lt;/span&gt;class plays key role in getting correct file’s content type and saving it. This class has following members that almost all we have used in this example!&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_kgf4jf6cd8w/SfLBJhf573I/AAAAAAAAAEk/2zU_OF19YJA/s1600-h/image%5B19%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="111" alt="image" src="http://lh3.ggpht.com/_kgf4jf6cd8w/SfLBK5oFCuI/AAAAAAAAAEo/NwJxQ_HbjUY/image_thumb%5B13%5D.png?imgmax=800" width="401" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Hope it helps.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/796466946303904267-3667847173925620959?l=mohyuddin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mohyuddin.blogspot.com/feeds/3667847173925620959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mohyuddin.blogspot.com/2009/04/uploading-file-in-aspnet-mvc_25.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/3667847173925620959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/3667847173925620959'/><link rel='alternate' type='text/html' href='http://mohyuddin.blogspot.com/2009/04/uploading-file-in-aspnet-mvc_25.html' title='Uploading File in ASP.NET MVC'/><author><name>Mahr G. Mohyuddin</name><uri>http://www.blogger.com/profile/11261291055128478260</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_kgf4jf6cd8w/SowwKDWbJ1I/AAAAAAAAAI0/ws-U9HfQvYU/S220/3a26081a-59e8-479c-81bd-7055f937dac4_100_100.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_kgf4jf6cd8w/SfLBFVsARvI/AAAAAAAAAEY/P3JVwkK6bqA/s72-c/image_thumb%5B10%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-796466946303904267.post-5124763036443412374</id><published>2009-04-18T01:07:00.000-07:00</published><updated>2009-08-09T11:59:46.615-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET MVC'/><title type='text'>ASP.NET MVC vs ASP.NET</title><content type='html'>I have been working on an application in ASP.NET MVC for last few months.  It was in Beta then, now Microsoft has released its first version and also made it open source under MS-PL.  I found it a great framework for web development as it provides you full control over all ins and outs of the request &amp; response over http. It utilizes HTTP to its full extent. You will definitely go for ASP.NET MVC instead of regular ASP.NET if want to achieve following objectives.

&lt;strong&gt;ASP.NET MVC&lt;/strong&gt;

&lt;strong&gt;1.&lt;/strong&gt; You want more control over Request and Response. No more ViewState and Postback. You have full control over the rendered HTML.
&lt;strong&gt;2.&lt;/strong&gt; You want to make your urls RESTful, i.e. your site is capable to have a unique url for each action associated with each item. ASP.NET MVC gets this influence from RESTful web services. And RESTful urls are definitely SEO friendly.
&lt;strong&gt;3.&lt;/strong&gt; You want clean separation of concerns. 
&lt;strong&gt;4.&lt;/strong&gt; You want to bring parallelism in development, i.e. one developer may work on View and another may work on controller and so on. This boosts productivity.
&lt;strong&gt;5.&lt;/strong&gt; ASP.NET MVC is best suited for Test Driven Development (TDD) as it is contract based (interface based) and is easily mockable.
&lt;strong&gt;6.&lt;/strong&gt; ASP.NET MVC provides fine grain control over any javascript framework like jQuery, Prototype etc. quite easily and intuitively.
&lt;strong&gt;7.&lt;/strong&gt; ASP.NET MVC is easily pluggable and extendable framework.
&lt;strong&gt;8.&lt;/strong&gt; Above all, now ASP.NET MVC is open source under MS-PL. So you have full source code to change anything you want.

&lt;strong&gt;ASP.NET&lt;/strong&gt;

Though ASP.NET provides you lot of advantages, regular ASP.NET still will remain in industry and has its own worth and importance.
&lt;strong&gt;1.&lt;/strong&gt; Provides a higher level of abstraction on Request and Response, brings ViewState and Postback in the cycle. Thus good option for novice web developers!
&lt;strong&gt;2.&lt;/strong&gt; Well suited for heavy data driven applications.
&lt;strong&gt;3.&lt;/strong&gt; Provides you set of server controls (built in &amp; third party) that helps you boost productivity.

In my upcoming posts I will show you how to work with ASP.NET MVC using JQuery.  JQuery is best suited Javascript framewok for ASP.NET MVC to work with. We'll see almost all important features from DOM scripting and UI to rich Ajax calls, related with all types of form posting scenarios.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/796466946303904267-5124763036443412374?l=mohyuddin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mohyuddin.blogspot.com/feeds/5124763036443412374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mohyuddin.blogspot.com/2009/04/aspnet-mvc-vs-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/5124763036443412374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/5124763036443412374'/><link rel='alternate' type='text/html' href='http://mohyuddin.blogspot.com/2009/04/aspnet-mvc-vs-aspnet.html' title='ASP.NET MVC vs ASP.NET'/><author><name>Mahr G. Mohyuddin</name><uri>http://www.blogger.com/profile/11261291055128478260</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_kgf4jf6cd8w/SowwKDWbJ1I/AAAAAAAAAI0/ws-U9HfQvYU/S220/3a26081a-59e8-479c-81bd-7055f937dac4_100_100.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-796466946303904267.post-6034472642260579556</id><published>2008-07-17T23:01:00.001-07:00</published><updated>2009-08-09T12:06:37.326-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UpdatePanel'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Response.Write/Response.BinaryWrite and File Download problem in UpdatePanel</title><content type='html'>&lt;p&gt;(Solution to Sys.WebForms.PageRequestManagerParserErrorException)&lt;/p&gt;&lt;p&gt;You&amp;#160; may face problem when you write download file logic in aspx page code behind while the the control that fires the event to download file is in update panel. If you use Response.Write() or Response.BinaryWrite() method as shown below in async postback you will encounter Sys.WebForms.PageRequestManagerParserErrorException.&lt;/p&gt;&lt;p&gt;&lt;a href="http://lh5.ggpht.com/gmohyd/SIBe-6RFcmI/AAAAAAAAACg/J7Nf3CAGKj4/clip_image002%5B7%5D.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="99" alt="clip_image002" src="http://lh5.ggpht.com/gmohyd/SIAxkBLkwpI/AAAAAAAAACk/QR0FT-vf_3Y/clip_image002_thumb%5B4%5D.jpg" width="403" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Page&amp;#8217;s markup&lt;/b&gt;&lt;/p&gt;&lt;pre class="brush:html" &gt;&lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;
&lt;/asp:ScriptManager&gt;
&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
    &lt;contenttemplate&gt;
        &lt;asp:Button ID=" ButtonDownload" runat="server" OnClick="ButtonDownload_Click" Text="Download" /&gt; &gt;
    &lt;/ContentTemplate&gt;
&lt;/asp:UpdatePanel&gt;
 &lt;/pre&gt;&lt;p&gt;&lt;b&gt;Page&amp;#8217;s Code behind&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;
&lt;pre class="brush:csharp"&gt;protected void ButtonDownload_Click(object sender, EventArgs e)
        {
            string fileName = "song.wav";
            string filePath = "Audio/song.wav";
            Response.Clear();
            Response.ContentType = "audio/mpeg3";
            Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName);
            string fileSeverPath = Server.MapPath(filePath);
            if (fileSeverPath != null)
            {

                byte[] fileBytes = GetFileBytes(fileSeverPath);

                Response.BinaryWrite(fileBytes);

                Response.Flush();
            }
        }
        protected byte[] GetFileBytes(string url)
        {
            WebRequest webRequest = WebRequest.Create(url);
            byte[] fileBytes = null;
            byte[] buffer = new byte[4096];
            WebResponse webResponse = webRequest.GetResponse();
            try
            {
                Stream stream = webResponse.GetResponseStream();
                MemoryStream memoryStream = new MemoryStream();
                int chunkSize = 0;
                do
                {
                    chunkSize = stream.Read(buffer, 0, buffer.Length);
                    memoryStream.Write(buffer, 0, chunkSize);
                } while (chunkSize != 0);
                fileBytes = memoryStream.ToArray();

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

            return fileBytes;
        }
&lt;/pre&gt;&lt;br /&gt;
The file download logic is simple. I have considered and audio file (say song.wav) to download that&amp;#8217;s placed in Audio folder in root of my website. I have written separate method that takes URL for the file to be downloaded and return the bytes of that file. &lt;/p&gt;&lt;p&gt;&lt;b&gt;Resolution of the Problem &lt;/b&gt;&lt;/p&gt;&lt;p&gt;There are several ways to fix this problem each fix has specific scops. &lt;/p&gt;&lt;ol&gt;&lt;li&gt;Register ButtonDownload &lt;b&gt;PostBackTrigger&lt;/b&gt;&lt;b&gt; &lt;/b&gt;control&lt;b&gt; &lt;/b&gt;in&lt;b&gt; Triggers&lt;/b&gt; child tag of the update panel as shown below. &lt;/li&gt;
&lt;/ol&gt;&lt;pre class="brush:html"&gt;&lt;asp:updatepanel id="UpdatePanel1" runat="server"&gt;
    &lt;contenttemplate&gt;
        &lt;asp:Button ID="ButtonDownload" runat="server" OnClick="ButtonDownload_Click" Text="Download" /&gt;&lt;a
        id="downloadFileLink"&gt;&lt;/a&gt;
        &lt;/ContentTemplate&gt;
    &lt;triggers&gt;
    &lt;asp:PostBackTrigger ControlID="ButtonDownload"/&gt;
    &lt;/Triggers&gt;
&lt;/asp:UpdatePanel&gt; 
&lt;/pre&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;You can also use &lt;b&gt;RegisterPostBackControl&lt;/b&gt; method of the ScriptManager control in Page_Load as shown below. &lt;/li&gt;
&lt;/ol&gt;&lt;pre class="brush:csharp"&gt;protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ScriptManager1.RegisterPostBackControl(ButtonDownload);
            }
        }
&lt;/pre&gt;&lt;ol&gt;&lt;li&gt;The drawback of these two approaches is obviuos i..e ultimatley you have to resort a full postback whenver you will need downlaod a file while the rest of the controls on the page are posting back asynchronously. This may lead to serious problems if you are using multiple update panels and you want them work simulatneolusly. Think of a scenario if you have a player in page and that is in a separate update panel. When it is playing file , you click on download file button. What will happen? A postback will occur that will close the player as complete page has to be posted back. In such cases we have to sort out some other way. You might have heard about &lt;b&gt;HttpHandlers&lt;/b&gt;. If not , then its time to know their strength; and in such a scenario you can learn their usefullness. So it lets have a look briefly. An HttpHanlder is a class that impliments IHttppHanlder and can be set traget of a particular request (HttpRequest). They can be thought of like ISAPI extenions that are basically dlls mapped against particular file extensions that all happens at IIS level. An HttpHanlder handles request with particular extensions after HttpModule completes their working on it. An HttpHanlder takes an httpcontext and handels it in a way you have told it to do. They are best when you want to isloate or separate an HttpRequest from main HttpContext to handle it in custom manner. Like our scenario, we want our download file request to be separated from main context so that it won&amp;#8217;t affect other ongoing requests/reponses of main httpcontext. There are built in HttpHandlers that automatically get registered in web.config. When we write a new httpHandler we have to reigister it but there are is support of generic handler with extension &lt;b&gt;.ashx&lt;/b&gt;(&lt;u&gt;as&lt;/u&gt;p &lt;u&gt;h&lt;/u&gt;andler &lt;u&gt;x&lt;/u&gt;) that does not require regsiteration. Lets add a new generic hanlder. Right click on your web site and chose Add new item. and then select Generic Handler as shown below &lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;&lt;a href="http://lh6.ggpht.com/gmohyd/SIAxnxcKT7I/AAAAAAAAACo/IEPECqHSPlY/clip_image004%5B6%5D.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="286" alt="clip_image004" src="http://lh5.ggpht.com/gmohyd/SIAxpWwvmdI/AAAAAAAAACs/GLdAe1gOvO8/clip_image004_thumb%5B3%5D.jpg" width="400" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Lets have a look on the file added&lt;/p&gt;&lt;p&gt;&lt;pre class="brush:csharp"&gt;&lt;%@ WebHandler Language="C#" Class="DownloadHandler" %&gt;
        using System;
        using System.Web;
        public class DownloadHandler : IHttpHandler
        {
            public void ProcessRequest (HttpContext context) 
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("Hello World");
            }

            public bool IsReusable {
                get {
                return false;
            }
        }

&lt;/pre&gt;&lt;br /&gt;
It has a method ProcessRequest that takes httpcontext in parameter and allows us to handle it in custom manner and a property IsReusable used to flag whether or not the current instance of the handler is resuable for the following similar requests. &lt;/p&gt;&lt;p&gt;Let add our download logic here in ProcessRequest method. Now after complete implementation our hanlder looks like this&lt;/p&gt;&lt;p&gt;&lt;pre class="brush:csharp"&gt;&lt;%@ WebHandler Language="C#" Class="DownloadHandler" %&gt;
        using System;
        using System.Web;
        public class DownloadHandler : IHttpHandler
        {
            public void ProcessRequest (HttpContext context) 
            {
              
                string fileName = context.Request.QueryString["fileName"];

                string filePath = context.Request.QueryString["filePath"];
                context.Response.Clear();
                context.Response.ContentType = "audio/mpeg3";
                context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName);
                string fileSeverPath = context.Server.MapPath(filePath);
                if (fileSeverPath != null)
                {
                    byte[] fileBytes = GetFileBytes(fileSeverPath);
                    context.Response.BinaryWrite(fileBytes);
                    context.Response.Flush();
                }
            }

            public bool IsReusable {
                get {
                return false;
            }
            }

            protected byte[] GetFileBytes(string url)
            {
                WebRequest webRequest = WebRequest.Create(url);
                byte[] fileBytes = null;
                byte[] buffer = new byte[4096];
                WebResponse webResponse = webRequest.GetResponse();
                try
                {
                    Stream stream = webResponse.GetResponseStream();
                    MemoryStream memoryStream = new MemoryStream();
                    int chunkSize = 0;
                do
                {
                    chunkSize = stream.Read(buffer, 0, buffer.Length);
                    memoryStream.Write(buffer, 0, chunkSize);
                } while (chunkSize != 0);

                fileBytes = memoryStream.ToArray();

                }
                catch (Exception ex)
                {

                   // log it somewhere

                }
               return fileBytes;

             }
        }
&lt;/pre&gt;&lt;p&gt;You might have noticed that the whole code is same as we used in the page just with few chnages , now all response, request are of the context being passed in paramater and we are getting file path and file name from query sting. &lt;/p&gt;&lt;p&gt;Lets come to last part of the story using this handler. You can call this handler by setting url of any url property supporting control and rasing its click hanlder programmterically or in windows.open in javascript. You might wonder , why I am not using Response.Redirect. Well you can use it, but in current scenario we cant use it as it will cause a postback. Remove download file logic from page code behind. All changes are in page&amp;#8217;s mark up. After chnages here is it. &lt;/p&gt;&lt;br /&gt;
&lt;pre class="brush:js"&gt;&amp;lt script type="text/javascript"&amp;gt

        function downloadFile(fileName, filePath) {
            var downloadLink = $get('downloadFileLink');
            downloadLink.href = "DownloadHandler.ashx?fileName=" + fileName + "&amp;filePath=" + filePath;
            downloadLink.style.display = 'block';
            downloadLink.style.display.visibility = 'hidden';
            downloadLink.click();

            return false;
        }

&amp;lt/script&amp;gt&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;


   &lt;div&gt;        &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
            &lt;contenttemplate&gt;
            &lt;asp:Button ID="ButtonDownload" runat="server" OnClientClick="return downloadFile('song.wav','audio/song.wav');" Text="Download" /&gt;
            &lt;a id="downloadFileLink"&gt; &lt;/a&gt;
            &lt;/ContentTemplate&gt;
        &lt;/asp:UpdatePanel&gt;
    &lt;/div&gt;&lt;/pre&gt;&lt;br /&gt;
Important point to note is that I have added and anchor in the page with id downloadFileLink and have resgister OnClientClick of the button with downloadFile javscript method that takes target file name and virtual relative path of the file (if used in GridView these may come from database) . When button is click downloadFile method is called that set the href proiperty of the anchor with the url to call DownloadHandler.&lt;/p&gt;&lt;p&gt;&lt;pre class="brush:js"&gt;&lt;b&gt;downloadLink.href = &amp;quot;DownloadHandler.ashx?fileName=&amp;quot; + fileName + &amp;quot;&amp;amp;filePath=&amp;quot; + filePath;&lt;/b&gt;
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;After setting it anchor is clicked programmatically and as result DownloadHandler is called and after processing the request shows following popup to save the file.&lt;/p&gt;&lt;p&gt;&lt;a href="http://lh5.ggpht.com/gmohyd/SIAxrrayQaI/AAAAAAAAACY/snqRldg7Rxo/clip_image006%5B6%5D.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="304" alt="clip_image006" src="http://lh6.ggpht.com/gmohyd/SIAxucRcDuI/AAAAAAAAACc/gvLeKVLW__A/clip_image006_thumb%5B3%5D.jpg" width="400" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Here is it. Enjoy!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/796466946303904267-6034472642260579556?l=mohyuddin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mohyuddin.blogspot.com/feeds/6034472642260579556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mohyuddin.blogspot.com/2008/07/responsewritreresponsebinarywritre-and.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/6034472642260579556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/6034472642260579556'/><link rel='alternate' type='text/html' href='http://mohyuddin.blogspot.com/2008/07/responsewritreresponsebinarywritre-and.html' title='Response.Write/Response.BinaryWrite and File Download problem in UpdatePanel'/><author><name>Mahr G. Mohyuddin</name><uri>http://www.blogger.com/profile/11261291055128478260</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_kgf4jf6cd8w/SowwKDWbJ1I/AAAAAAAAAI0/ws-U9HfQvYU/S220/3a26081a-59e8-479c-81bd-7055f937dac4_100_100.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/gmohyd/SIAxkBLkwpI/AAAAAAAAACk/QR0FT-vf_3Y/s72-c/clip_image002_thumb%5B4%5D.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-796466946303904267.post-519562280164825460</id><published>2008-07-16T22:19:00.000-07:00</published><updated>2008-07-16T22:31:44.250-07:00</updated><title type='text'>Purifying Heart</title><content type='html'>&lt;b&gt;Sustain Me, Lord&lt;/b&gt;
Strengthen me, my lord,&lt;br/&gt;for I am overcome with feebleness. &lt;br/&gt;Ennoble me once more,&lt;br/&gt;for I have been cast down.&lt;br/&gt;Sustain me, Lord, &lt;br/&gt;for I am impoverished.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/796466946303904267-519562280164825460?l=mohyuddin.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mohyuddin.blogspot.com/feeds/519562280164825460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mohyuddin.blogspot.com/2008/07/purifying-hearts.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/519562280164825460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/796466946303904267/posts/default/519562280164825460'/><link rel='alternate' type='text/html' href='http://mohyuddin.blogspot.com/2008/07/purifying-hearts.html' title='Purifying Heart'/><author><name>Mahr G. Mohyuddin</name><uri>http://www.blogger.com/profile/11261291055128478260</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_kgf4jf6cd8w/SowwKDWbJ1I/AAAAAAAAAI0/ws-U9HfQvYU/S220/3a26081a-59e8-479c-81bd-7055f937dac4_100_100.jpg'/></author><thr:total>1</thr:total></entry></feed>
