Dave's Notebook

Tab Control ActiveTabIndex Lost on Postback

tran-land-01 I just got off the phone with a client who is using the MS-AJAX TabControl in one of his applications and any time he causes a postback, the tab resets to the first tab.

If you’ve never seen the problem, you’re lucky.  There are a couple of ways around the problem.  The first and easiest if it works in your situation is to put the tab in an update panel so that you never actually do a full postback.

Read More

ASP.NET MVC - Model != BLL or DAL

Last week I introduced the ASP.NET MVC framework by talking a bit about what the model, view and controller are. In the comments, John Meyer said,

I respectfully disagree with your claim that the model is your BLL. MVC is a UI layer pattern, and as such all models, views, and controllers are strictly in the UI level.

While historically, MVC has been described in the way I stated–while the ASP.NET MVC guys have also portrayed the Model as BLL or below–I have to agree with John.  Here’s why: At least as far as ASP.NET is concerned, the model is inherited from a specific class.  This means that any implementation code you place in the class will be forever tied to the class it inherits from.

Read More

ASP.NET Response.Redirect() and JavaScript

A toucan perched on a branch in Brazil. Yesterday we covered issues surrounding using ASP.NET’s Response.Redirect in server side code. We noted that not handing it correctly could prevent code from running on the server that we want to run. The other issue is emitting Javascript in the server side in association with Response.Redirect(). This also leads to unexpected problems if you aren’t thinking about what is actually happening with your code. Take this code as an example:

Read More

Unsafe Mode in C#

tp_vol4_006 One of the “advantages” of using CSharp instead of VB.NET is that if programmers want to, they have the option of bypassing the memory management of .NET and working with memory directly.  This is called “unsafe” mode.

While I will show you how to use this keyword, I have to tell you up front that I’ve been using CSharp since Beta 2 of .NET 1.0 and I’ve NEVER needed to switch into unsafe mode to do any of the work that I’ve done.

Read More

Bypass VPN for regular traffic

IMG_1380 For as many places as I’ve been where they use VPNs, I’ve yet to find one that is set up correctly.  I suppose there is a good reason for this, but I consider the problem to be mostly Microsoft’s fault. I mean, wouldn’t you assume that if it were possible to use your regular connection for all the network traffic EXCEPT for the traffic that needs to go through the VPN, that is what you would want?  But no.  Microsoft sets it up so that ALL of your traffic goes through the VPN connection.

Read More