Dave's Notebook

Prevent Postback on Buttons

IMG_1380 Over the weekend I got a question about how to prevent postbacks on buttons from within jQuery tabs.  But the question really isn’t specific to jQuery.  There are other times when you might not want a button to post back.  So how do you do this? There are several ways you might accomplish this depending on what your goal is. The first, and most obvious choice, is to not use an ASP:Button control and use an HTML input type=”button” tag instead.  This will allow you to have full control over what is happening on the client side.  If at all possible, this should be your first choice.

Read More

jQuery, Each() and Async Gets

H04K0067

One of the things to keep in mind when using jQuery is that nothing is a blocking call.  Sure, there is a certain sequence to when things operate.  But, to be safe, you should always assume that step two will happen during step one.

Nowhere is this more evident than when retrieving content from a URL and inserting that content in your page.

The temptation is to write code that looks something like this:

Read More

Forms Authentication – Manual Authentication

F03I0043

I’ve had several occasions in the past where I’ve needed to do my own authentication or I’ve needed to add some additional methods to the authentication process.

As easy as Microsoft has made the authentication process, you might think that in order to manually authenticate you’d need to write all of your authentication code manually.  But nothing could be farther from the truth.

Read More

iTextSharp Tables

food-ml-04 PDF Tables in iTextSharp work enough like HTML tables that the slight differences between the two make programming tables for a PDF a bit confusing the first time you try.

I hope to describe some of those differences here so that your experience might be a bit smoother than mine was as you start to use tables in your PDF code.

One of the first decisions you’ll need to make as you start working on your iTextSharp table is how many columns the table should have.  Keep in mind that the cells can be spanned, just like they can in HTML, so it is better to have too many columns than the bare minimum.  You can always adjust later.

Once you’ve decided how many columns, you’ll need to decide how big you want each column to be.  Unlike HTML, the columns will not stretch if they are too small.

Here is your initial code:

Read More