Quick Tip: Use JQuery to submit a TextBox.

Posted by & filed under Development.

Submitting a search box when <Enter> is pressed is a nice usability feature to provide.  Unfortunately, ASP.NET Web Forms and its requirement for a single <form> tag breaks this expected behavior when there is more than one submit button on the page.   This can be easily fixed with a JavaScript and JQuery.   Listening to the… Read more »

Invoke an action between ASP.Net pages. Create a simple REST API for an ASP.NET page

Posted by & filed under Web Development.

Update March 1, 2013 I didn’t have a full understanding of a REST service at the time I wrote this post. I have a better understanding now and recommend using ASP.NET Web API I needed a simple way for one page to call an action in another page.  In the spirit of a RESTful API…

JavaScript Variable Pattern

Posted by & filed under Web Development.

To help make writing and maintaining JavaScript easier in ASP.NET I have started to use a pattern that isolates the JavaScript variables away from the core script.  By doing this I can avoid a bunch of string concatenation in my server side code and embedded code blocks in my .aspx page when rendering dynamic JavaScript. … Read more »

Calling a button click from JavaScript in ASP.NET

Posted by & filed under Web Development.

ASP.NET web forms page have a JavaScript method for handling PostBacks called “__doPostBack”.  This function is used to submit button clicks back to the server. function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } The cool thing is that you can take advantage of… Read more »