San Jose International Short Film Festival – Best of Day 1

Day 1 was the red carpet opening along with a revue of past favorites, followed by a round of comedy shorts from recent years.

My favorites so far:

“Fool’s Day” 

Trailer (some spoilers):

Full movie:

Comments: Oh. My. God. This was wonderful, and very dark stuff. Absolutely brilliant comedy filmmaking by Cody Blue Snider. I only wish I could get this on disc to show off to friends.

Status Update: A Facebook Fairy Tale

https://www.youtube.com/watch?v=zxWMZdBMi1Q

Hilarious, snarky, and NSFW British movie from Dan Reisinger.

Chronicles Simpkins will Cut Your Ass
image

Brendan Hughes has a hilarious (and evil) take on the mean kids terrorizing the school playground… except this time, it’s elementary school and the gang of toughs is led by a pig-tailed trash-mouth named Chronicle Simpkins. It’s that rare short that starts out funny and gets funnier and funnier.

The Answers

A man dies and gets answers to all his questions about his life. A great premise, strong performances, tight plotting and a compelling emotional arc–everything a short film should be.

Error Prevention is Way Better than a Cure when it Comes to .Net Error Handling

Here’s a fun little .Net speed optimization I found out today:

(In both of these “Reader” is a DataReader which I’m using to loop through a set of database records.)

Code #1:

dim myValue as string

While Reader.Read()
  Try
     myValue = Reader("FieldWhichMayNotExist")
  Catch
     myValue = "This is a default value"
  End Try
end While

And here’s Code #2:

dim myValue as string

dim fieldExists as Boolean = 
FigureOutIfFieldExists(Reader, "FieldWhichMayNotExist")

While Reader.Read()
  if fieldExists then
     myValue = Reader("FieldWhichMayNotExist")
  else
     myValue = "This is a default value"
  end if
End While

So, what’s the big difference? The first one traps for the field not existing and inserts a default value if so; and the second one wastes a bunch of time going through a routine to see if the field exists, then loops through and uses the result of that first scan to use either the field value or the default value accordingly.

You might think that the two would run in similar amounts of time–or maybe even Code #1 would be a little faster, since it didn’t waste a few precious milliseconds scanning to see if the field exists.

But here’s the shocker:  Code sample #2 runs about 20 times faster than code sample #1, since it doesn’t need to deal with the whole .Net exception architecture. In the case of the actual code upon which this was based, it meant the difference between being able to insert 630,000 records in around 100 seconds, vs. more than an hour.

Exception handling: it’s more expensive than you think–particularly inside loops. Prevention in this case was worth 20 times more than a cure.

Laws of Intended Consequences: Grocery Store Checkout Misery in California

Line

This was the scene tonight at my local Safeway as I attempted to grab a quick twelver of Becks to refill the office fridge.

In case it doesn’t look dire enough from here, here’s the scene behind me in line.

Line-2

At this point, gentle reader. you might be a bit curious as to why Californians seem to love waiting in grocery store lines so much that they don’t speed their way through the four (!)  readily open self-checkout lanes seen at the front of the first picture. Lanes so lonely for company that the checker overseeing them began touting them, carnival barker-style, while none of the doomed patrons in line could do more than grimace and sourly wait for the next available spot at the one open checker.

The answer is found in the sign posted at the front of the Checkout lane

Line-3

In a another world–in fact, the world we had just 18 months ago as it turns out–I’d have grabbed my brews, swooped through checkout in a minute or less, and be back at my office jangling my still-cold beers in a plastic bag (that cost less than a penny to make, and which easily holds my purchases together while contributing nothing at all to the inconvenience of the journey, and requiring a fraction of the energy and environmental waste of the “eco-friendly” reusable bag that  every shopper in California is practically required to hoard).

But thankfully, I was saved from this hell of convenience by our wise leaders in the State Legislature–who have Done Something about the Very Pressing Problem of… uhh… what, exactly?

Stopping underage drinking? After all, a minor could just grab a case of beer and… what? Get carded at checkout by the scowling clerk watching the lines like always once the big “Alcohol Purchase–Show ID to Checker”: signal goes off on the self-checkout?

Were underage buyers really standing in line to law-abidingly pay for their non-lawful booze at self-checkout (vs. the much more sensible action of simply shoplifting the brewskis using the now-mandatory “reusable bags” that everyone now carries–thanks to the same legislators?)

If one is overly cynical about the actual motives of this law (and I’ve found it’s very, very difficult to be even appropriately cynical where politicians are concerned), one might suspect that the actual reason for this new prohibition is to lessen the usefulness of self-checkout–which has been catching on hugely in the past few years since it offers customers a way to pay without waiting forever, and which offers store owners a way to control labor costs in an era of massive increases in mandatory minimum wages.

Perhaps it was a payoff to their friends in the grocery unions. Or a way to “Do Something” about the lack of employment brought on by their ever-increasing minimum wages that make it utterly uneconomical to hire low-skilled workers for starter jobs… like checkout clerk.

But once again, thanks legislators. Your willingness to step forward and Do Something–about plastic bags, minimum wages… and now the terrible perils of unregulated self-checkout… has made grocery shopping in California the delight it is.

What to do if your keyboard stops working after upgrading to Windows 10 on a MacBook Pro running Boot Camp

Well, this was a little vexing…

My go-to computer on the road is a MacBook Pro (Retina), which I use Apple’s Boot Camp software on to allow it to simultaneously be a bad-ass MacOS X computer and a killer Windows machine. It really is a terrific laptop.

While on a trip this week, I got a notice (on the Windows side) that Windows 10 was ready to download as a free update to the Windows 7 I had installed. Having done a flawless upgrade of my main desktop to Windows 10, I unhesitatingly clicked “Upgrade”, and an hour or so later, I was staring at the Windows 10 login screen on my newly upgraded laptop. “Press Ctrl+Alt+Delete to Login” it instructed…

I pressed it. Nothing happened. Pressed it again.. three times.. a dozen times… nothing. Rebooted. Powered the machine off. Let it wait for a while. Switched to the Mac side. Switched back. (At least I knew that the keyboard was sorta-working, as it recognized the Alt/Option key for switching boot partitions). But everytime I got to the Windows login screen, I was SOL.

After my trip, I plugged in an external keyboard and it instantly got past the login screen. I installed updates to Windows 10 but when I rebooted, the same problem persisted. What the devil was going on?

Turns out, the Apple keyboard drivers that came with Boot Camp got deactivated or otherwise messed with by the upgrade, so it was unable to handle the delete key in the upper-right of the built-in keyboard (most likely treating it as backspace instead).

The workaround: To hit Command-U at the login to activate the accessibility settings and use the onscreen virtual keyboard to trigger a Ctrl-Alt-Delete.

The fix: Boot back over to the Mac side, go to the Utilities folder and launch Boot Camp assistant. Download the (sorta) latest drivers.* onto a USB thumb drive. Then boot back over to Windows, pull the virtual keyboard trick to log in, then run the setup program on the flash drive to repair the drivers. Reboot, and all is well.

Hope this helps someone!

*It actually installs drivers from 2014, but attempting to directly download the Boot Camp 5.1xxx drivers from the Apple site results in an installer that refuses to run on this machine–even though it was specifically listed among the supported machines on the Apple site).

First World Problems: Geek Edition — Mixing 4K and 1080p monitors (Updated)

Update: Apparently, my initial belief that Font scaling across all monitors was indeed true of Windows 7 and 8, but was changed in Windows 8.1 (and now Windows 10).

This is another of those “writing it so that another overly tech-exuberant geek doesn’t have to spend as long sussing what’s going on as I did” post.

I bought myself a Dell 27″ P2715Q monitor as an “I shipped a product!” present to myself after the release of ComicBase 2015 R2. It’s been a stunning upgrade, and worth every penny of the $500 I paid for it.

The problem comes in that it has so darn many pixels at such a high density, that using some sort of font magnification is virtually required–much as is the case with Apple’s retina displays. Since the monitor itself is so much larger than the 23″ 1080p monitor it replaces, I settled on a modest 135% font size setting as a nice balance between making the font size large enough to read comfortably, and preserving the amount of information that could be shown on the screen.

One thing I hadn’t bargained for is that since I’ve become accustomed to running with a 2 monitor setup, the text on the 1080p monitor I use as a second monitor seemed ludicrously huge in comparison to the text on the big 4K monitor to its left.

For days, I chalked this up to just being part of the learning curve–I thought that part of getting used to such high resolution on the 4K monitor was tricking me into believing that the other monitor was stupidly oversized, and that it’d probably been that huge all along.

Then–duh!–I just realized that the Font-scaling setting in Windows doesn’t apply to each monitor separately. It applies across everything. By making the fonts on my 4K monitor large enough to read, I was simultaneously making the text  gigantic on the 1080p monitor next to it. So large, in fact, that it was unwieldy. (Note: This is true of all versions of Windows prior to v8.1 [or Windows 10] — Windows 8.1 introduced per-monitor font scaling, although the feature is so far virtually unsupported outside of core Microsoft applications).

So what’s the answer? I could, in theory, use the Resolution control on the main monitor to set it to run in something other than its native 4K resolution, but the unfortunate result of doing that is to take the razor-sharp 4K text and render it muddy and indistinct. (LCD monitors really like to be run at their native resolutions, or they have to interpolate pixels, resulting in soft images and text).

Stupid answer #1 would be to get used to incredibly teeny text on the 4K monitor by switching the font magnification off. Stupid answer #2 would be to buy a second 4K monitor if I insist on running a dual monitor setup. Unfortunately, my budget does not currently support such extravagance (hey, I got a kid about to attend UCLA in the fall!)

I suspect the immediate solution will be to either get used to gigantic-looking text on the second monitor, or simply remove the second monitor from my setup. If so,  I suspect I’ll miss the extra space–especially since so much of my work involves separate coding and viewing windows, particularly on remote systems.

In any case, at least I’m no longer confused as to why things look so freakishly large on the 1080p monitor.

Ah… first world problems…

Update: I’ll be trying Stupid Solution #4 for a bit now that Windows 10 has been released, offering per-monitor font-scaling. Which is, to see whether I can manage to create a working development environment using two different monitors at two different font scales. Or, more challengingly, to see if we can get a truly resolution-independent version going of our current development projects. So far, I’m wading through the rather elaborate technical notes on attempting this here. Wish me luck–it looks like the development process is ugly to say the least…

-Pete

Review: Advanced Installer 12.2 from Caphyon Ltd.

Bottom Line

A powerful, well-supported installer  that checks all the boxes in terms of features and stands well above the rest of the pack in terms of support and ease of use.


Windows Installers: A Den of Scum and Villainy…with the Occasional Hero

The world of Windows Installers is a bleak one for the most part, full of bloated, breathtakingly expensive, and frankly lackadaisical offerings from the industry leaders, and half-baked, ill-supported packages from the less-expensive competitors.

Almost all come with fearsome learning curves, four-figure prices for initial purchase (with much more required for support and maintenance), and a general “hands off” approach to customer relations once the purchase has been made.

Unless the package you’re deploying is incredibly simple in nature, you’re likely to find yourself overmatched both by the prices and the complexity of the various installer packages, with little in the way of support except the odd technical forum or too-slow-to-be-useful email support system.

Having dealt with more of this sort of thing than we’re comfortable recounting, it was with some surprise that we dug into the workings of Caphyon Ltd.’s Advanced Installer 12.2 and found what appears to be a company that is actually throwing some effort into making an installer package that’s both usable and full-featured enough to handle complex installs.

Checking the Boxes

Advanced Installer comes in multiple versions, from the surprisingly full-featured $399 Professional version to the $2999 “Architect” version which is, frankly, of most use to sysadmins managing very complex enterprise software distributions. A freeware version for very simple installs is also available.

Most Windows application developers will find themselves drawn to the Professional version, which handles both installation and updating of 32 and 64 bit applications across any Windows platform. Those with need of patch creation or dialog editing will find themselves eying the $1499 Enterprise edition, as will those who need to take advantage of the all-too-common need to add the software they’re installing to the Windows Firewall. The need to shell out another $1,000 to get that last feature is a particular pain point to small developers.

A full breakdown of the features of the various versions can be found on the Caphyon web site.

Getting into the IDE

Caphyon makes a decent attempt to ease the burden of creating an installer by providing numerous project types to start you off. Unfortunately, the descriptions of each type could use a bit more fleshing out, and it wouldn’t be a bad idea to quiz the user a bit on the sort of features they intend to use to help them pick the proper template.

Advanced Installer-Project Types

Once you’ve chosen a template and gotten started, most of the work is accomplished by stepping through the various product information screens to define how your product will be installed.

Advanced Installer-Product Details

These pleasantly work in a fairly standard manner, but with a number of nice interface touches along the way to help guide you along and prevent common errors. There’s a general attention to detail on display throughout the IDE which — although it doesn’t quite rise to the level found in consumer level software — goes far beyond what is typical in enterprise offerings such as this.

Help and Support

Advanced Installer does a good job of providing context-based help, and their web site contains copious documentation which is reasonably organized, if sometimes a little light on details. They also host a strong support community with a surprisingly high “signal to noise” ratio in terms of providing guidance.

Another area where Advanced Installer rises about the rest of the contenders for InstallShield’s crown is in the responsiveness of their technical support staff.  Support was friendly, and–more to the point–got straight down to business in solving the problem with a minimum of time-consuming back-and-forth.No matter how skilled you are as a developer, it’s comforting to know that the product you’ll be relying on to build your own product is well-supported–both by the company itself and its community of users. Here, Advanced Installer shows some real strength.

Building the Installer

We used the 30-day trial of Advanced Installer to really work the product over by devising a copycat installer of our horrifically complicated ComicBase Archive Edition install–a beast of a project that involves everything from installing .Net frameworks and configuring dozens of merge modules to installing everything from fonts to graphic files across numerous folders on the target hard drive.

Advanced Installer-Files

We won’t lie: we did hit a few hitches along the way, and turned to Caphyon’s tech support a couple of times to answer questions about how things work, and at one point to address a bug in the generated install file. All things considered, however, the experience wasn’t half bad, and we managed to get a working version of the installer generated with less than a day’s work.

Having used competing products from InstallShield, InstallAware, and Wise, the Advanced Installer IDE was similar enough to be navigable without a lot of instruction, and did a better job than most of the competition in guiding us through the more complicated bits of the process. It also excelled in the sheer speed of the IDE, never suffering the slow-downs that made others come to a crawl once large numbers of files were added.

The product as a whole still feels “young” — with a few rough edges to be found for sure, but also with an energy behind its design and its support community which is sorely needed in the enervated world of Windows installers. We’d love to see further refinement of the product in terms of additional wizards for complex areas (e.g. setting up firewall exceptions), as well as with better integrated support for providing repositories of downloadable merge modules and the like.

All in all, however, Advanced Installer was a very pleasant surprise: a much-needed shot of youthfulness and energy in a sedentary field of development, but one which carries with it the sort of chops that allow you to take it seriously for the creation of even very complicated installers.

Kudos for Great Tech Support: Caphyon and Advanced Installer 12.2

Even geeks need to call for help sometimes, and when we do, it’s rarely for something that can be solved by turning the machine off and on.

The sort of software problem which trips up professional programmers tends toward the complex, and often comes in configurations that require encyclopedic knowledge of everything from NTFS and IIS permission settings to DNS routing maps to understand. It’s not something that lends itself to adequate resolution by having some underpaid drone read off a script, or tell the user to check out the support forums for ideas.

Another feature of enterprise-level software? It ain’t cheap, often costing hundreds or thousands of dollars, often with license renewals every 12-18 months. Over a ten year development lifetime, it’s not uncommon to lay out four or even five figures with a software vendor for a single piece of development software.

So when you’ve just dropped a grand or more on an development package only to get told that doing anything beyond posting a question in the forums is beyond their ability to support, it’s a frustrating experience indeed. But sadly, too many makers of software geared toward developers think this is an acceptable way to go.

Luckily, there are still a few companies which seem to take support seriously, and I’ve had occasion to do business with all three of them in the same week.

Installers

The Windows installer-creating software field desperately needs shaking up, with behemoth InstallShield very comfortably occupying the mediocre throne, atop $699 “express” versions to create very simply products, up to $4,999 “Premiere” editions (with suggested $1300 annual “Gold maintenance” support plan!) for creating full-featured programs.

We’d tried using the Express version years ago before discovering that it was inadequate to the task of installing–much less patching and updating–ComicBase. We wound up switching to the ill-fated Wise Installer, which did a respectable enough job, but whose company was bought and sold like a paid woman at a biker rally, ultimately being discontinued.

Attempting to move to a something more modern (capable of installing .Net 4.5, for instance), we made an extremely ill-advised investment in a cross-grade to InstallAware, only to suffer through such anguish-inducing customer service that we were ultimately left with a dead loss on the $1000 we paid, and not even left with an installable version of the installer tool (!). There’s a future blog entry–if not a couple of chapters in a book on how to alienate customers–in covering the saga.

Having been previously burned, we were wary of the den of scum and villainy which seemed to comprise the Windows Installer tool market when we discovered Caphyon Ltd. who makes a product called Advanced Installer 12.2. Accordingly, we gave their product a full test during the 30 day demo period, using it to recreate the surprisingly complex ComicBase 2015 installer package (which must install all manner of system files, .Net Framework components, thousands of graphic files, and other bits and pieces).

Unlike some of their competitors, Advanced Installer didn’t claim to be able to read in the existing .msi file we use now (InstallAware claimed to be able to do this, but failed to make a usable installer from it). As such, we basically had step through the entire complicated installer process from scratch, while looking at a copy of the old Wise installer for reference.

Surprisingly, we were done within an hour, and without any of the interminable “compressing files” and “scanning files” lags which bedeviled the original creation of the installer using Wise.

Unfortunately, we ran into a fatal error when attempting to build the final installer, so we reached out to Caphyon’s tech support for assistance. We got an email back within a few hours asking to examine a copy of the installer file, which we promptly sent over. Within half a day, we received back a fixed version of the installer file, along with a request to help them investigate further to make sure no future customer ran into a similar problem.

It’s worth noting that at this point, we hadn’t even become a customer yet, yet they resolved our highly technical problem efficiently and with speed and professionalism. This is the way that support for professional-class products should go, but too often does not.

Kudos to the support team at Caphyon. (And may the others in this space learn from them as they hopefully steal away your underserved customers).

When It’s Deadly Important For Nice People to Be Rude

194522_5_

According to some folks–politely known as “psychopaths”–the above cartoon is a perfectly good excuse to commit murder. Hell, in their anally-inserted world view, committing murder over this is practically a moral commandment.

These people are barbarians. Savages. And yes, Islamists.

“Nice People” — a group to which I often deem myself to be a member — try to avoid irritating people unnecessarily. And we certainly try not to poke offense at other people’s religion. It’s rude. It seems classless. And frankly, who needs the grief?

So it is that when the so-called “Religion of Peace” ™ decided to wage bloody war on the West, we “Nice People” fell all over ourselves trying not to be confrontational. We very respectfully blew the hell out of countless wanna-be martyrs and jihadists, all the while pretending that this had little or nothing to do with the core doctrines of a whole religion. It was utter nonsense, but we all pretended to believe it, lest we cause offense to our Muslim friends and neighbors who weren’t psychotic nutjobs bent on murder. Like I said, we’re Nice People–and Nice People try not to cause offense.

But it turns out that being nice isn’t always the way to avoid conflict. If someone insists that something about the very way you are is offensive to them, you have a choice: either tell that person you’re terribly sorry, but he’ll just have to go fuck himself–or decide that you’re willing to live your life constrained by what the other fellow considers offensive.

Nice People, when confronted with this situation, typically decide that a little bit of self-censorship is a small price to pay for keeping the peace. And, within a broad spectrum of American societal norms, I don’t have a problem with this. After all, we can all agree that it’s rude to swear in public, talk about sex in front of children, or parade around naked on the street. At the same time, in a free America, we’ve had huge and earnest disagreements about whether or not people should be free to do exactly those things–and not always just on the Berkeley campus.

But now we find ourselves faced with a menace to exactly the sort of freewheeling give and take that makes life in the West meaningful. We have a huge number of people who’ve essentially said, “You’ll do things our way, our we’ll kill you.”

My friends,  my fellow Nice People, it’s time to stop being so damn Nice.

It bears mentioning that mere “niceness” isn’t the only reason we’ve let things get to the state where free-thinking Americans are afraid to call our these Islamist miscreants for the oppressive scum they are. A lot of us, quite frankly, are afraid.

simpsons425

Sure, we’ll bravely mock Christians all day long with “artistic” pictures of the Virgin Mary in elephant dung, or crosses submerged in urine. We’ve also got a best-selling Broadway play, “The Book of Mormon” which takes the piss out those wacky (and ridiculously wholesome) Mormons in a  savage way. And for this, we applaud. We’re not so nice here. By sanctioning this sort of offense, we’re “edgy” and “brave”.

But point out the horrific problems with Islam–the repression, the treatment of women, and the sheer bloody trail of terror that follows it wherever it gains a majority, and suddenly we’re tripping all over ourselves to be the polite ones.

Let’s be honest for a moment. This isn’t about politeness. It’s about cowardice.

Because unlike those zany Mormons or those repressive and evil Christians, we all think that there’s a pretty good chance that someone who gets their 411 on what G-d wants from a Koran  will decide that he’s had quite enough of our B.S., and is going to try to kill us.

And make no mistake, the threat is real. As the obnoxious and brave staff of Charlie Hebdo found out so recently, as did any number of other Westerners who dared to be Western enough to think that they had actual freedom of speech. Stand up for it, and a nutcase may try to kill you. So decide if you think it’s worth it.

707185-charlie

I don’t know about the rest of you, but I’ve had it. I’m sick to death of cowtowing to the so-called”Religion of Peace” and its fanatical followers. I don’t actually get up in the morning and think, “how can I offend someone today by saying something inconsiderate”, but G-d damn it, I’m not willing to sit here and let the craziest person in the room dictate the terms of what can be said in the West.

If you’re reading this from America or a country in Western Europe, congratulations. We were born in freedom, and most of us have never actually had to fight for it. Thankfully we have people like the ridiculously courageous Pam Geller at the American Freedom Defense Initiative–who showed her mettle with her provocative–and clearly needed–Muhammad cartoon contest this past weekend. It was a contest meant to prove a point about the low state of free speech in America–and explosive punctuation to this was added by two would-be mass murderers who showed up to try to slaughter the infidels who dared draw a fucking cartoon.

(As it turned out, the best illustration that day, as some wag put it,  was the chalk outline left around the two jihadis thanks to a sharpshooting cop providing security for the event.)

But if the rest of us wish to remain free people, we can’t afford to let the Pam Gellers and the Geert Wilders of the world do the work of defending liberty for us. We need to relearn the art of telling obnoxious prudes–especially the psychotic ones–to fuck the hell off.

At the very least, we should cut the “tut-tutting’ about being offensive when we discuss people like Geller and Wilders. Whether we would say what they say or not, their courage is what allows us the freedom in our own lives to express ourselves. Because if you think freedom of speech is only about the freedom to say socially approved things, you’re already a slave–and a moron.

Nice People of the World, it’s time to stop being so Fucking Nice.

Fixing Slow App Launches on an iPhone 5 with IOS 8

Recently, my iPhone 5 started bogging down in an epic way–it would take forever to launch apps, often stalling out entirely and requiring multiple tries to even get apps to launch. I tried restarting, shutting down other apps, etc. and nothing worked.

I started seriously wondering whether this was an evil plan that Apple had slipped into later versions of iOS 8 to punish folks who’d declined to drop a couple hundred bucks to upgrade to an iPhone 6.

As it turns out, the culprit was a newish setting under Settings > General called “Background App Refresh”. The purpose of this setting is to allow apps to pull down new content when you’re on a wi-fi network, and is no doubt a lovely thing on some level. But, between Dropbox, Chrome, FaceBook, Instagram, Mailbox, Messenger, and a dozen other apps, it was murdering my phone.

I turned it off, and my phone was instantly back to normal. You can control this setting on an individual app level, so perhaps later I’ll experiment with turning off various apps to figure out the biggest culprits. But for now, I’m just happy to have a reasonably working phone again.

Using Bootstrap Modal Dialogs with ASP.Net and Master Pages

This is a short blog about solving a nasty problem with using Bootstrap’s Modal Dialogs with ASP.NET and Master Pages.

Most examples for using Bootstrap’s very robust dialog support go something like this:

Page Code:

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel="stylesheet" 
  href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<link rel="stylesheet" 
  href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css" />
<script type="text/javascript" src="/includes/js/jquery-min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js">
</script>
</head>

<body>
    <form id="form1" runat="server">
        <asp:Button ID="btnShowModal" runat="server" 
            Text="Show Modal" 
            CssClass="btn btn-primary btn-info" 
            data-target="#pnlModal"
            data-toggle="modal" 
            OnClientClick="javascript:return false;" />
        <asp:Panel ID="pnlModal" runat="server" role="dialog" 
           CssClass="modal fade">
            <div class="modal-dialog">
                <div class="modal-content" runat="server">
                    <div class="modal-header">
                        <button type="button" class="close" 
                            data-dismiss="modal">
                            <span aria-hidden="true">&times;</span>
                            <span class="sr-only">Close</span>
                        </button>
                        <h4 class="modal-title">
                          Bootstrap Modal Dialog in ASP.NET</h4>
                    </div>
                    <div class="modal-body">
                        <p>
                            This is the body text
                        </p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" 
                         class="btn btn-default" 
                        data-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </asp:Panel>
    </form>
</body>
</html>

Pushing the button shows the dialog, and everything’s ducky. But try the same thing in an ASP.Net app with a master page and nothing happens.

Why? The answer comes down to the “data-target” attribute of the invoking button, which is meant to tell Bootstrap the panel to activate:

<asp:Button ID="btnShowModal" runat="server" Text="Show Modal"
 CssClass="btn btn-primary btn-info" data-target="#pnlModal"
 data-toggle="modal" OnClientClick="javascript:return false;" />

The problem is that in an application with master pages, the actual rendered name of the pnlModal div will likely become something like “ctl00_ContentPlaceHolder1_pnlModal” and Bootstrap won’t be able to associate it with the necessary JavaScript to show the dialog so the button does nothing.

To solve this, you just need to set the data-target to pnlModal’s clientID (the rendered name). Since data-target isn’t a standard, supported HTML attribute, you can use the Attributes.Add method to set it via the Page_Load event of your code-behind as follows:

Code-behind Code (VB)

Protected Sub Page_Load(sender As Object, e As EventArgs) 
   Handles Me.Load
  If Not Page.IsPostBack Then
    Me.btnShowModal.Attributes.Add("data-target", "#" & pnlModal.ClientID)
  End If
End Sub

…and you’re good to go!


Credit: This post builds upon KHComputers’ excellent contribution about Bootstrap Modal Dialogs in ASP.NET at VBForums