<?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>Rick Schott :: devlpr.net</title>
	<atom:link href="http://blog.devlpr.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.devlpr.net</link>
	<description></description>
	<lastBuildDate>Sun, 29 Apr 2012 04:19:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to get script tags with jQuery .find from ajax result</title>
		<link>http://blog.devlpr.net/2012/04/29/how-to-get-script-tags-with-jquery-find-from-ajax-result/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-get-script-tags-with-jquery-find-from-ajax-result</link>
		<comments>http://blog.devlpr.net/2012/04/29/how-to-get-script-tags-with-jquery-find-from-ajax-result/#comments</comments>
		<pubDate>Sun, 29 Apr 2012 04:18:00 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=721</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: jscript; title: ; notranslate">
$.ajax({
    type: &quot;GET&quot;,
    dataType: 'html',
    contentType: 'application/x-www-form-urlencoded',
    url: '/url',
    success: function (data) {
        //have to replace script or else jQuery will remove them
        var parsedHTML = data.replace(/script/gi, 'rickscript');
        $(parsedHTML).find('rickscript').each(function (index, domEle) {
            if (!$(this).attr('src')) {
                eval($(this).text()); //feeling lucky execute it
            }
        });
    }
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2012/04/29/how-to-get-script-tags-with-jquery-find-from-ajax-result/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using ucajax to render UserControls via WCF</title>
		<link>http://blog.devlpr.net/2012/01/24/using-ucajax-to-render-usercontrol-via-wcf/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-ucajax-to-render-usercontrol-via-wcf</link>
		<comments>http://blog.devlpr.net/2012/01/24/using-ucajax-to-render-usercontrol-via-wcf/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 15:09:44 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[SignalR]]></category>
		<category><![CDATA[signalR]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=699</guid>
		<description><![CDATA[I recently released an open source project called ucajax hosted on GitHub and also available via NuGet. The project&#8217;s main purpose is to render ASP.NET UserControls via web services, currently supporting WCF and WebMethods.   It also comes will a fully functional demo that consumes the NuGet package and can be viewed live here. There are few limitations such as postbacks, it doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I recently released an open source project called <a href="http://www.devlpr.net/ucajax/" target="_blank">ucajax</a> hosted on <a href="https://github.com/rickschott/uc-ajax" target="_blank">GitHub</a> and also available via <a href="http://nuget.org/packages/ucajax" target="_blank">NuGet</a>. The project&#8217;s main purpose is to render ASP.NET UserControls via web services, currently supporting WCF and WebMethods.   It also comes will a fully functional demo that consumes the <a href="http://nuget.org/packages/ucajax" target="_blank">NuGet package</a> and can be viewed live <a href="http://devlpr.net/ucajaxdemo" target="_blank">here</a>.</p>
<p>There are few limitations such as postbacks, it doesn&#8217;t support them.   Ucajax will also strip out resources/form tags&#8230;etc and only sends you the content of the UserControl.   This is done for a few reasons.  ASP.NET will get upset if new ViewState or forms get injected into the DOM that it doesn&#8217;t know about.</p>
<p>The simplest example is the <a href="http://devlpr.net/ucajaxdemo/LoadViaClient.aspx?anotherparam=test" target="_blank">Load Via Client WCF</a> example.</p>
<p>1. Add ucajax to your project via NuGet:</p>
<p><a href="http://nuget.org/packages/ucajax"><img class="aligncenter size-full wp-image-705" title="ucajax NuGet package" src="http://www.devlpr.net/blog/wp-content/uploads/2012/01/nuget_ucajax.png" alt="" width="600" height="197" /></a></p>
<p>2. Create a UserControl:</p>
<p><em><strong>Markup:</strong></em></p>
<pre class="brush: xml; title: ; notranslate">

&lt;%@ Control Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;UserControlSimple.ascx.cs&quot; Inherits=&quot;ucajax.web.Controls.UserControlSimple&quot; %&gt;

&lt;asp:label ID=&quot;lblTitle&quot; Text=&quot;I am a simple UserControl using asp:label&quot; runat=&quot;server&quot;/&gt;&lt;br&gt;
&lt;asp:label ID=&quot;lblTextProperty1Title&quot; Text=&quot;TextProperty1 = &quot; runat=&quot;server&quot;/&gt;&lt;asp:label ID=&quot;lblTextProperty1&quot; Text=&quot;&quot; runat=&quot;server&quot;/&gt;
&lt;!--and some html--&gt;&lt;br&gt;
&lt;asp:hyperlink ID=&quot;hlLinkToMe&quot; Text=&quot;I am also using asp:hyperlink&quot; NavigateUrl=&quot;https://github.com/rickschott/uc-ajax&quot; runat=&quot;server&quot;/&gt;&lt;br&gt;
&lt;asp:label ID=&quot;lblReload&quot; runat=&quot;server&quot; Text=&quot;Wait 30 seconds and I will reload myself using all the sever-side parameters originally used.&quot; /&gt;&lt;br&gt;
&lt;asp:label ID=&quot;lblDateTime&quot; Text=&quot;&quot; runat=&quot;server&quot;/&gt;&lt;br&gt;
&lt;asp:label ID=&quot;lblTextProperty2Title&quot; Text=&quot;TextProperty2 = &quot; runat=&quot;server&quot;/&gt;&lt;asp:label ID=&quot;lblTextProperty2&quot; Text=&quot;&quot; runat=&quot;server&quot;/&gt;
</pre>
<p><em><strong>Code-behind:</strong></em></p>
<pre class="brush: csharp; title: ; notranslate">
namespace ucajax.web.Controls
{
    public partial class UserControlSimple : System.Web.UI.UserControl
    {
        public string TextProperty1 { get; set; }
        public bool TextProperty2 { get; set; }
        public bool AjaxAutoRefresh { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            lblTextProperty1.Text = TextProperty1;
            lblTextProperty2.Text = TextProperty2.ToString();
            lblDateTime.Text = &quot;Oh, look at the time: &quot; + DateTime.Now.ToString();
            lblReload.Visible = AjaxAutoRefresh;
        }
    }
}
</pre>
<p>3. Add some markup to a .aspx:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;ajaxifyspinner&quot; class=&quot;ajaxifyspinner&quot;&gt;
    &lt;asp:Image ID=&quot;imgResultsProgress&quot; ImageAlign=&quot;Middle&quot; runat=&quot;server&quot; ImageUrl=&quot;~/Images/ajax-loader.gif&quot; /&gt;
&lt;/div&gt;
&lt;div id=&quot;AJAXContent&quot;&gt;
&lt;/div
</pre>
<p>4. Add some script that will render the UserControl:</p>
<pre class="brush: jscript; title: ; notranslate">
var baseUrl = &quot;&quot;;
    $(document).ready(function () {
        var model = new $.ucajax.viewModel($.ucajax.DICTIONARY_TYPE.WCF);
        model.ajaxControlViewModel.ControlPath = baseUrl + &quot;Controls/UserControlSimple.ascx&quot;;
        model.ajaxControlViewModel.ControlParams.push(new model.keyValuePair(&quot;TextProperty1&quot;, &quot;Set via JavaScript, rendered via WCF!&quot;));
        model.ajaxControlViewModel.ControlParams.push(new model.keyValuePair(&quot;TextProperty2&quot;, &quot;True&quot;));
        model.ajaxControlViewModel.ControlParams.push(new model.keyValuePair(&quot;AjaxAutoRefresh&quot;, &quot;True&quot;));

        $().ucajax({ contentId: 'AJAXContent',
            postData: model,
            RESTUrl:  baseUrl + 'Service/AjaxContent.svc/GetAJAXControl',
            ajaxSpinnerId: 'ajaxifyspinner',
            autoRefresh: true
        });
    });
</pre>
<p>5. You now have a UserControl rendered via a WCF web service:</p>
<p style="text-align: center;"><a href="http://devlpr.net/ucajaxdemo/LoadViaClient.aspx?anotherparam=test"><img src="http://www.devlpr.net/blog/wp-content/uploads/2012/01/jsonpost-24-2012-10-16-17-AM.png" alt="" title="JSON post" width="600" height="218" class="aligncenter size-full wp-image-718" /></a></p>
<p style="text-align: center;"><a href="http://devlpr.net/ucajaxdemo/LoadViaClient.aspx?anotherparam=test"><img class="aligncenter size-full wp-image-708" style="border-image: initial; border-width: 1px; border-color: black; border-style: solid;" title="Rendered content" src="http://www.devlpr.net/blog/wp-content/uploads/2012/01/render_1-24-2012-10-06-43-AM.png" alt="" width="596" height="256" /></a></p>
<p>Now, go create something and tell me about, would love to hear your feedback!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2012/01/24/using-ucajax-to-render-usercontrol-via-wcf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a demo chat app in MVC3, backbone.js and a little SignalR for fun&#8230;</title>
		<link>http://blog.devlpr.net/2012/01/23/building-a-demo-chat-app-in-mvc3-backbone-js-and-a-little-signalr-for-fun/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-a-demo-chat-app-in-mvc3-backbone-js-and-a-little-signalr-for-fun</link>
		<comments>http://blog.devlpr.net/2012/01/23/building-a-demo-chat-app-in-mvc3-backbone-js-and-a-little-signalr-for-fun/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 14:34:25 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[backbone]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[backbone.js]]></category>
		<category><![CDATA[MVC3]]></category>
		<category><![CDATA[signalR]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=675</guid>
		<description><![CDATA[I have been doing a lot of reading lately on backbone.js. One of the key features I wanted to explore was it&#8217;s concept of Models and how it keeps the server side in sync with RESTful JSON endpoints. What is backbone.js? Backbone supplies structure to JavaScript-heavy applications by providing models with key-value binding and custom events, collections with a rich [...]]]></description>
			<content:encoded><![CDATA[<p>I have been doing a lot of reading lately on <a href="http://documentcloud.github.com/backbone/" target="_blank"> backbone.js</a>. One of the key features I wanted to explore was it&#8217;s concept of <a href="http://documentcloud.github.com/backbone/#Introduction" target="_blank">Models</a> and how it keeps the server side in sync with RESTful JSON endpoints.</p>
<p><a href="https://github.com/rickschott/fire-camp"><img class="aligncenter size-full wp-image-683" title="backbone_demo" src="http://www.devlpr.net/blog/wp-content/uploads/2012/01/backbone_demo1.png" alt="" width="600" height="387" /></a></p>
<p><strong>What is backbone.js?</strong></p>
<blockquote><p><a href="http://github.com/documentcloud/backbone/">Backbone</a> supplies structure to JavaScript-heavy applications by providing <strong>models</strong> with key-value binding and custom events, <strong>collections</strong> with a rich API of enumerable functions, <strong>views</strong> with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.</p></blockquote>
<p>I started searching the internet to find an example in the .NET world, surely someone has an example already?  I did run across a few posts that got me in the right direction:</p>
<p><a href="http://wekeroad.com/2011/08/11/the-backbonejs-todo-list-sample-refactored-part-1/" target="_blank">The Backbone.js Todo List Sample, Refactored – Part 1</a> via <a href="http://twitter.com/robconery" target="_blank">@robconery</a><br />
<a href="http://www.bitcandies.com/blog/2011/asp-net-mvc3-restful-application-tutorial-with-backbone-js-part-i/"> ASP.NET MVC3 RESTful application tutorial with Backbone.js – Part I</a><br />
<a href="http://www.bitcandies.com/blog/2011/asp-net-mvc3-restful-application-tutorial-with-backbone-js-%E2%80%93-part-ii//"> ASP.NET MVC3 RESTful application tutorial with Backbone.js – Part II</a><br />
<a href="http://www.bitcandies.com/blog/2011/asp-net-mvc3-restful-application-tutorial-with-backbone-js-%E2%80%93-part-iii/"> ASP.NET MVC3 RESTful application tutorial with Backbone.js – Part III</a><br />
<a href="https://gist.github.com/1655019" target="_blank"> A Backbone.js demo app (Sinatra Backend)</a> via <a href="https://github.com/ryandotsmith" target="_blank">ryandotsmith</a></p>
<p>The <a href="http://www.bitcandies.com" target="_blank">BitCandies</a> series was more than I needed, the last article with <a href="http://www.sinatrarb.com/intro.html" target="_blank">Sinatra </a>is what I was looking for.  All I wanted to see was how backbone.js posts to the RESTful endpoints.   If I could see that in action I knew I could do the same with MVC3 <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.jsonresult.aspx" target="_blank">JsonResults</a> in a Controller.</p>
<p><strong>The chat demo:</strong><br />
This demo uses MVC3 Controllers as the RESTful JSON endpoints utilizing the Json ActionResult. I also made a MVC3 Model called Message to keep the client and server-side parity. I cheated with persistence using a static class, no database needed to run the demo. The original demo I forked from used setInterval to poll the server for new messages. This worked but for only one client. I wanted this to work like a real chat app would, so I replaced that with <a href="https://github.com/SignalR/SignalR" target="_blank">SignalR</a> to let the clients know new messages have arrived and to update their data. <em>I know I could replace the Controllers with <a href="https://github.com/SignalR/SignalR" target="_blank">SignalR</a> all together but this is a demo to show how to use all the pieces, not a best practices.</em></p>
<p><strong>/Views/Shared/_Layout.cshtml</strong>(script references needed) </p>
<pre class="brush: xml; title: ; notranslate">
    .........
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery-1.6.4.min.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/modernizr-1.7.min.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/underscore.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/backbone.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery.signalR.min.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/signalr/hubs&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    .........
    &lt;/body&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/application.js&quot;)&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
    .........
</pre>
<p><strong>/Scripts/application .js</strong> (this is basically the single page app initializer for this example)</p>
<pre class="brush: jscript; title: ; notranslate">
// SignalR Proxy created on the fly
var chat = $.connection.chat;

var Message = Backbone.Model.extend({});

var MessageStore = Backbone.Collection.extend({
 model: Message,
   url: '/messages'
});
var messages = new MessageStore;

var MessageView = Backbone.View.extend({

   events: { &quot;submit #chatForm&quot; : &quot;handleNewMessage&quot; }

  , handleNewMessage: function(data) {
    var inputField = $('input[name=newMessageString]');
    messages.create({ content: inputField.val() });

    //signalr call to server
    chat.send(&quot;dummy message, just signaling&quot;)
            .done(function () {
                console.log('Success!')
            })
            .fail(function (e) {
                console.warn(e);
            })
    inputField.val('');
  }

  , render: function() {
    var data = messages.map(function(message) { return message.get('content') + '\n'});
    var result = data.reduce(function(memo,str) { return memo + str }, '');
    $(&quot;#chatHistory&quot;).text(result);
    return this;
  }

});

messages.bind('add', function(message) {
  messages.fetch({success: function(){view.render();}});
});

var view = new MessageView({el: $('#chatArea')});

//replaced with SignalR
//setInterval(function(){
//  messages.fetch({success: function(){view.render();}});
//},10000)

// Declare a function on the chat hub so the server can invoke it
chat.reloadMessages = function (message) {
    //server callback, reload messages from server via backbone!
    messages.fetch({ success: function () { view.render(); } });
};

// Start the connection
$.connection.hub.start();

//get any messages on load, .fetch is backbone.js working here
messages.fetch({ success: function () { view.render(); } });
</pre>
<p><strong>/Models/MessageModels.cs</strong></p>
<pre class="brush: csharp; title: ; notranslate">
namespace BackboneMVC3SignalR.Models
{
    public class Message
    {
        public string content { get; set; }
    }

}
</pre>
<p><strong>/Controllers/MessagesController.cs</strong></p>
<pre class="brush: csharp; title: ; notranslate">
namespace BackboneMVC3SignalR.Controllers
{
    public class MessagesController : Controller
    {
        //
        // GET: /Messages/

        public ActionResult Index()
        {
            List&lt;Message&gt; s = new List&lt;Message&gt;();
            if (GlobalVariables.Messages != null)
            {
                s = GlobalVariables.Messages;

            }

            return Json(s, JsonRequestBehavior.AllowGet);
        }

        [HttpPost]
        public ActionResult Index(string content)
        {
            List&lt;Message&gt; s = new List&lt;Message&gt;();
            if (GlobalVariables.Messages != null)
            {
                s = GlobalVariables.Messages;

            }
            s.Add(new Message{ content = content});
            GlobalVariables.Messages = s;

            return Json(s, JsonRequestBehavior.AllowGet);

        }

    }
}
</pre>
<p><strong>/Hubs/Chat.cs</strong></p>
<pre class="brush: csharp; title: ; notranslate">
namespace BackboneMVC3SignalR.Hubs
{
    public class Chat : Hub
    {
        public void Send(string message)
        {
            // Call the reloadMessages method on all clients
            Clients.reloadMessages(message);
        }
    }
}
</pre>
<p>Full working demo can be found on <a href="https://github.com/rickschott/fire-camp">GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2012/01/23/building-a-demo-chat-app-in-mvc3-backbone-js-and-a-little-signalr-for-fun/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Postback UpatePanel on close of jQuery dialog</title>
		<link>http://blog.devlpr.net/2011/11/15/postback-upatepanel-on-close-of-jquery-dialog/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postback-upatepanel-on-close-of-jquery-dialog</link>
		<comments>http://blog.devlpr.net/2011/11/15/postback-upatepanel-on-close-of-jquery-dialog/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 18:43:41 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=646</guid>
		<description><![CDATA[Put a hidden asp:button within the UpdatePanel or outside and set it as an AsyncPostBackTrigger. Call the js function from ItemDataBound if needed, passing in the ClientID of the hidden asp:button. The js function will call the click event on the button passed in once the &#8220;OK&#8221; or whatever you set buttonTxt to, button is [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>Put a hidden <code>asp:button</code> within the <code>UpdatePanel </code> or outside and set it as an <code>AsyncPostBackTrigger</code>.</li>
<li>Call the js function from <code>ItemDataBound </code>if needed, passing in the <code>ClientID </code>of the hidden<code> asp:button</code>.</li>
<li>The js function will call the click event on the button passed in once the &#8220;OK&#8221; or whatever you set <code>buttonTxt </code>to, button is clicked.</li>
<li>You can then handle the <code>UpdatePanel.Update</code> automatically if the button is inside the <code>UpdatePanel </code>or call <code>Update </code>within the <code>butHidden_Click</code>.</li>
</ul>
<p><strong>Markup:</strong></p>
<pre class="brush: xml; title: ; notranslate">
    &lt;asp:UpdatePanel runat=&quot;server&quot; ID=&quot;UpdatePanel1&quot;&gt;
         &lt;asp:button id=&quot;btnHidden&quot; style=&quot;display:none&quot; runat=&quot;server&quot; onclick=&quot;btnHidden_Click&quot;/&gt;
     &lt;/asp:UpdatePanel&gt;
</pre>
<p><strong>Script:</strong></p>
<pre class="brush: jscript; title: ; notranslate">
       function showjQueryUIDialogOkBtnCallback(buttonToClick, dialogSelector, buttonTxt, isModal, width, height)
       {
           var buttonOpts = {};
           buttonOpts[buttonTxt] = function () {
    	       $(&quot;#&quot; + buttonToClick).trigger('click');
           };

           buttonOpts['Cancel'] = function () {
    	       $(this).dialog(&quot;close&quot;);
    	       $(this).dialog('destroy');
           }

           $(dialogSelector).dialog({
    	       resizable: false,
    	       height: height,
    	       width: width,
    	       modal: isModal,
    	       open: function (type, data) {
    	           $(this).parent().appendTo(&quot;form&quot;); //won't postback unless within the form tag
    	       },
    	       buttons: buttonOpts

           });

           $(dialogSelector).dialog('open');

        }
</pre>
<p><a href="http://stackoverflow.com/questions/8059802/asp-net-with-jquery-popup-dialog-how-to-post-back-on-dialog-closing/8059850#8059850" target="_blank">ASP.NET with jQuery popup dialog: how to post back on dialog closing</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2011/11/15/postback-upatepanel-on-close-of-jquery-dialog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cross browser keypress event handling</title>
		<link>http://blog.devlpr.net/2011/11/09/cross-browser-keypress-event-handling/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cross-browser-keypress-event-handling</link>
		<comments>http://blog.devlpr.net/2011/11/09/cross-browser-keypress-event-handling/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 18:46:20 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=639</guid>
		<description><![CDATA[Running example on JSFiddle: JavaScript Madness: Keyboard Events]]></description>
			<content:encoded><![CDATA[<p>Running example on <a href="http://jsfiddle.net/xsqrd">JSFiddle</a>:</p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function () {
    $(&quot;#TextBox1&quot;).live('keypress', function (e) {
        var kCode = e.keyCode || e.charCode; //cross browser check
        //Mozilla and Safari define e.charCode, while IE defines e.keyCode which returns the ASCII value
        if (kCode == 9) {
           $(&quot;#TextBox2&quot;).focus();
        }
    });
});
</pre>
<p><a href="http://unixpapa.com/js/key.html" target="_blank">JavaScript Madness: Keyboard Events</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2011/11/09/cross-browser-keypress-event-handling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load dynamic controls without dll or project references and assign properties</title>
		<link>http://blog.devlpr.net/2011/11/04/load-dynamic-controls-without-dll-or-project-references-and-assign-properties/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=load-dynamic-controls-without-dll-or-project-references-and-assign-properties</link>
		<comments>http://blog.devlpr.net/2011/11/04/load-dynamic-controls-without-dll-or-project-references-and-assign-properties/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 21:59:30 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[ASP.NET 4.0]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=630</guid>
		<description><![CDATA[I recently had to load an instance of a specific control within a masterpage base class that had no direct references but would be available at run-time.   Here is how I approached it. I first used LoadControl via a fully qualified assembly name.  I then used dynamic to set properties to bypass compile time checks:]]></description>
			<content:encoded><![CDATA[<p>I recently had to load an instance of a specific control within a masterpage base class that had no direct references but would be available at run-time.   Here is how I approached it.</p>
<p>I first used <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.page.loadcontrol.aspx" target="_blank">LoadControl </a>via a fully qualified assembly name.  I then used <a href="http://msdn.microsoft.com/en-us/library/dd264741.aspx" target="_blank">dynamic </a>to set properties to bypass compile time checks:</p>
<pre class="brush: csharp; title: ; notranslate">
Control knownControl = FindControl(&quot;KnownControl&quot;);
if (knownControl != null)
{
    string assemblyName = &quot;Com.YourNameSpace.UI&quot;;
    string controlAssemblyName = string.Format(&quot;{0}.{1},{0}&quot;, assemblyName, &quot;AwesomeControl&quot;);

    Type type = Type.GetType(controlAssemblyName);
    if (type != null)
    {
	dynamic control = LoadControl(type, null);
	control.YourAwesomeName = &quot;Awesome Name&quot;;
	control.ShowAwesomeName = true;

	knownControl.Controls.Add(control);
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2011/11/04/load-dynamic-controls-without-dll-or-project-references-and-assign-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Glimpse into the future of MVC debugging</title>
		<link>http://blog.devlpr.net/2011/04/22/a-glimpse-into-the-future-of-mvc-debugging/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-glimpse-into-the-future-of-mvc-debugging</link>
		<comments>http://blog.devlpr.net/2011/04/22/a-glimpse-into-the-future-of-mvc-debugging/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 12:36:24 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[MVC]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=626</guid>
		<description><![CDATA[What Firebug is for the client, Glimpse does for the server&#8230; in other words, a client side Glimpse into whats going on in your server.]]></description>
			<content:encoded><![CDATA[<blockquote><p><a href="http://getglimpse.com/" target="_blank">What Firebug is for the client, Glimpse does for the server&#8230; in other  words, a client side Glimpse into whats going on in your server.</a></p></blockquote>
<p style="text-align: center;">
<iframe title="YouTube video player" width="640" height="390" src="http://www.youtube.com/embed/ke8Rw2BGPG0" frameborder="0" allowfullscreen></iframe></p>
<p style="text-align: center;"><a href="http://nuget.org/List/Packages/Glimpse"><img class="size-full wp-image-627 aligncenter" title="Glimpse" src="http://devlpr.net.dotnet-host.com/blog/wp-content/uploads/2011/04/nugetlogo.png" alt="" width="26" height="27" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2011/04/22/a-glimpse-into-the-future-of-mvc-debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Infinite Scroll with MVC 2</title>
		<link>http://blog.devlpr.net/2011/04/12/jquery-infinite-scroll-with-mvc-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-infinite-scroll-with-mvc-2</link>
		<comments>http://blog.devlpr.net/2011/04/12/jquery-infinite-scroll-with-mvc-2/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 17:55:36 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=611</guid>
		<description><![CDATA[The inspiration for this post came from answering a question on Stack Overflow: jQuery Infinite Scroll and Gridview Controller: View: Script:]]></description>
			<content:encoded><![CDATA[<p>The inspiration for this post came from answering a question on <a href="http://stackoverflow.com/" target="_blank">Stack Overflow</a>:<br />
<a href="http://stackoverflow.com/questions/5117934/jquery-infinite-scroll-and-gridview/5118008#5118008" target="_blank">jQuery Infinite Scroll and Gridview</a></p>
<p><strong>Controller:</strong></p>
<pre class="brush: csharp; title: ; notranslate">

/// &lt;summary&gt;
/// GET: /Widget/Search/
/// Displays search results.
/// &lt;/summary&gt;
/// &lt;param name=&quot;s&quot;&gt;&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
public ActionResult Search(SearchType searchType, string s, [DefaultValue(1)]int page)
{
    try
    {
        int batch = 20;
        int fromRecord = 1;
        int toRecord = batch;

        if(page != 1)
        {
            toRecord = (batch * page);
            fromRecord = (toRecord - (batch-1));

        }

        var widgets= _repos.Search(searchType, s, fromRecord, toRecord );

        if (widgets.Count == 0)
        {
            InfoMsg(&quot;No widgets were found.&quot;);
        }

        if (Request.IsAjaxRequest())
        {
            if(widgets.Count &gt; 0)
            {
                return View(&quot;SearchResultsLineItems&quot;, widgets);
            }
            else
            {
                return new ContentResult
                {
                    ContentType = &quot;text/html&quot;,
                    Content = &quot;noresults&quot;,
                    ContentEncoding = System.Text.Encoding.UTF8
                };
            }

        }

        return View(&quot;SearchResults&quot;, widgets);
    }
    catch (Exception ex)
    {
        return HandleError(ex);
    }
}
</pre>
<p><strong>View:</strong></p>
<pre class="brush: csharp; title: ; notranslate">
&lt;% if (Model.Count &gt; 0) { %&gt;
    &lt;table id=&quot;tblSearchResults&quot;&gt;
        &lt;tr&gt;
            &lt;th&gt;&lt;/th&gt;
            &lt;th&gt;Col1&lt;/th&gt;
            &lt;th&gt;Col2&lt;/th&gt;
            &lt;th&gt;Col3&lt;/th&gt;
            &lt;th&gt;Col4&lt;/th&gt;
            &lt;th&gt;Col5&lt;/th&gt;
            &lt;th&gt;Col6&lt;/th&gt;
        &lt;/tr&gt;
        &lt;% Html.RenderPartial(&quot;SearchResultsLineItems&quot;, Model); %&gt;
    &lt;/table&gt;
    &lt;div id=&quot;loadingSearchResults&quot; style=&quot;text-align:center;height:24px;&quot;&gt;&lt;/div&gt;
    &lt;div id=&quot;actionModal&quot; class=&quot;modal&quot;&gt;&lt;/div&gt;
    &lt;% } %&gt;
</pre>
<p><strong>Script:</strong></p>
<pre class="brush: csharp; title: ; notranslate">

$(document).ready(function() {
    initAutoPaging();
});

function initAutoPaging() {
    $(window).scroll(function () {
        if ($(window).scrollTop() == $(document).height() - $(window).height()) {
            loadMore()
        }
    });
}

var current = 1;
function loadMore() {
    if (current &gt; -1) {
        if (!_isShowingDetails)
        {
            if (!$('#loadingSearchResults').html()) {
                current++;
                $('#loadingSearchResults').show();
                $('#loadingSearchResults').html(&quot;&lt;img src='/content/images/loading.gif' /&gt;&quot;);
                $.ajax({
                    async: true,
                    url: document.URL + &quot;?&amp;page=&quot; + current,
                    contentType: &quot;application/x-www-form-urlencoded&quot;,
                    dataType: &quot;text&quot;,
                    success: function(data) {
                    if (data != 'noresults') {
                            $('#tblSearchResults tr:last').after(data);
                            $('#loadingSearchResults').hide();
                            $('#loadingSearchResults').html('');
                            highlightSearch();
                        } else {
                            current = -1;
                            $('#loadingSearchResults').show();
                            $('#loadingSearchResults').html(&quot;&lt;h3&gt;&lt;i&gt;-- No more results -- &lt;/i&gt;&lt;/h3&gt;&quot;);
                        }
                    }
                });
            }
        }

    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2011/04/12/jquery-infinite-scroll-with-mvc-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Host your own NuGet feed</title>
		<link>http://blog.devlpr.net/2011/04/04/host-your-own-nuget-feed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=host-your-own-nuget-feed</link>
		<comments>http://blog.devlpr.net/2011/04/04/host-your-own-nuget-feed/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 03:08:02 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[NuGet]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=605</guid>
		<description><![CDATA[No need to re-write this, Phil Haack has already provided all that is needed.  I did this to test my own NuGet packages locally. Step 1: Create a new Empty Web Application in Visual Studio Step 2: Install the NuGet.Server Package Step 3: Add Packages to the Packages folder Step 4: Deploy and run your [...]]]></description>
			<content:encoded><![CDATA[<p>No need to re-write this, <a href="http://haacked.com/" target="_blank">Phil Haack</a> has already provided all that is needed.  I did this to test my own NuGet packages locally.</p>
<blockquote>
<h3>Step 1: Create a new Empty Web Application in Visual Studio</h3>
<h3>Step 2: Install the <em>NuGet.Server</em> Package</h3>
<h3>Step 3: Add Packages to the Packages folder</h3>
<h3>Step 4: Deploy and run your brand new Package Feed!</h3>
</blockquote>
<p><a href="http://haacked.com/archive/2011/03/31/hosting-simple-nuget-package-feed.aspx" target="_blank">Hosting a Simple “Read-Only” NuGet Package Feed on the Web</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2011/04/04/host-your-own-nuget-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a NuGet package in 5 minutes</title>
		<link>http://blog.devlpr.net/2011/02/06/create-a-nuget-package-in-5-minutes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-a-nuget-package-in-5-minutes</link>
		<comments>http://blog.devlpr.net/2011/02/06/create-a-nuget-package-in-5-minutes/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 04:28:09 +0000</pubDate>
		<dc:creator>rick schott</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[NuGet]]></category>

		<guid isPermaLink="false">http://blog.devlpr.net/?p=565</guid>
		<description><![CDATA[1. Register for a NuGet account to get your Access Key needed for deploying your NuGet Package to the public repository. 2. Install NuGet. 3.  Then download the NuGet.exe command-line utility. 4.  Create a .nuspec file 5. Pack your NuGet package from the command-line: I do mine in the post-build event like this so my [...]]]></description>
			<content:encoded><![CDATA[<p>1. <a href="http://nuget.org/Users/Account/Register" target="_blank">Register </a>for a NuGet account to get your Access Key needed for deploying your NuGet Package to the public repository.</p>
<p>2. Install <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/27077b70-9dad-4c64-adcf-c7cf6bc9970c/file/37502/5/NuGet.Tools.vsix" target="_blank">NuGet</a>.</p>
<p>3.  Then download the <a href="http://nuget.codeplex.com/releases/52018/download/184132" target="_blank">NuGet.exe command-line utility</a>.</p>
<p>4.  Create a <a href="http://nuget.codeplex.com/documentation?title=Nuspec%20Format" target="_blank">.nuspec</a> file</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;package xmlns=&quot;http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd&quot;&gt;
  &lt;metadata &gt;
    &lt;id&gt;MarrDataMapper&lt;/id&gt;
    &lt;version&gt;1.0.0&lt;/version&gt;
    &lt;authors&gt;Jordan Marr, Rick Schott(NuGet)&lt;/authors&gt;
    &lt;requireLicenseAcceptance&gt;true&lt;/requireLicenseAcceptance&gt;
    &lt;description&gt;Marr DataMapper provides a fast and easy to use wrapper around ADO.NET that enables you to focus more on your data access queries without having to write plumbing code.&lt;/description&gt;
     &lt;language&gt;en-US&lt;/language&gt;
    &lt;projectUrl&gt;http://marrdatamapper.codeplex.com/&lt;/projectUrl&gt;
    &lt;licenseUrl&gt;http://marrdatamapper.codeplex.com/license&lt;/licenseUrl&gt;
    &lt;tags&gt;ORM&lt;/tags&gt;
  &lt;/metadata&gt;
  &lt;files&gt;
     &lt;file src=&quot;binDebug*.dll&quot; target=&quot;lib&quot; /&gt;
  &lt;/files&gt;
&lt;/package&gt;
</pre>
<p>5.  Pack your NuGet package from the command-line:</p>
<pre class="brush: xml; title: ; notranslate">
NuGet.exe pack marrdatamapper.nuspec -b &quot;path to your project&quot;  -o &quot;path for output of generated .nupkg file&quot;
</pre>
<p>I do mine in the post-build event like this so my .nupkg is always ready to be published:</p>
<pre class="brush: xml; title: ; notranslate">
&quot;$(ProjectDir)NuGetNuGet.exe&quot; pack &quot;$(ProjectDir)NuGetmarrdatamapper.nuspec&quot; -b &quot;$(ProjectDir)&quot;  -o &quot;$(ProjectDir)$(OutDir)&quot;
</pre>
<p><img class="aligncenter size-full wp-image-588" title="nuget_proj_struct" src="http://devlpr.net/blog/wp-content/uploads/2011/02/nuget_proj_struct.png" alt="" width="279" height="291" /></p>
<p><img class="aligncenter size-full wp-image-586" title="nuget_post_build" src="http://devlpr.net/blog/wp-content/uploads/2011/02/nuget_post_build1.png" alt="" width="582" height="433" /></p>
<p>6.  The last step is to push your .nupkg file to the NuGet Gallery</p>
<pre class="brush: xml; title: ; notranslate">
nuget.exe push &quot;..bin/debug/MarrDataMapper.1.0.0.nupkg&quot; 99999999-9999-9999-9999-999999999999
</pre>
<p><strong>Results:</strong><br />
A fresh new package in the <a href="http://nuget.org/Packages/Packages" target="_blank">NuGet Gallery</a> online and the Visual Studio Package Manager.<br />
<img class="aligncenter size-full wp-image-591" title="nuget_lib_mgr" src="http://devlpr.net/blog/wp-content/uploads/2011/02/nuget_lib_mgr.png" alt="" width="895" height="605" /><br />
<img class="aligncenter size-full wp-image-594" title="nuget_gallery" src="http://devlpr.net/blog/wp-content/uploads/2011/02/nuget_gallery1.png" alt="" width="1020" height="475" /></p>
<p><strong>Resources:</strong><br />
<a href="http://nuget.org/" target="_blank">NuGet.org</a><br />
<a href="http://nuget.codeplex.com/documentation?title=Package%20Manager%20Console%20Command%20Reference" target="_blank">Package Manager Console Command Reference</a><br />
<a title="Creating a Package" href="http://nuget.codeplex.com/documentation?title=Creating%20a%20Package" target="_blank">Creating a Package</a><br />
<a href="http://nuget.codeplex.com/documentation?title=Nuspec%20Format" target="_blank">.nuspec File Format</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.devlpr.net/2011/02/06/create-a-nuget-package-in-5-minutes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

