Thursday, January 6, 2011

Can we use ASP.NET WebForms and MVC together in one project?

Yes.
1. Easiest way: Create a MVC project, add web form into it.
2. Another way:  Update your web forms project to support MVC on top it. Steps following:
- Add  references to System.Web.Abstractions, System.Web.Mvc and System.Web.Routing
- Update web.config. Compare your web form project to a empty MVC one
- Add routing code into Global.asax.cs
- Create folders for Controllers and Views

References:
http://blogs.imeta.co.uk/MGodfrey/archive/2009/03/31/663.aspx
This one is for MVC 1.0. You need to adjust for 2.0

http://www.sqlmag.com/article/aspnet2/MVC-and-Web-Forms-Two-Great-Tastes-Together-.aspx

Wednesday, January 5, 2011

How to ppulate dropdown list in FireFox and IE in JQuery

var option = new Option(optionData.Text, optionData.Value);
if ($.browser.msie) {
dropdownList.add(option);
}
else {
dropdownList.add(option, null);
}

How to rotate table (turn rows into columns) in MS SQL

Using PIVOT and UNPIVOT
http://msdn.microsoft.com/en-us/library/ms177410.aspx

ASP.NET events sequence: Page load event in master page is called after content page load event

Page load event in master page is called after content page load event

the master page is merged into the content page and treated as a control in the content page

Events in ASP.NET Master and Content Pages
http://msdn.microsoft.com/en-us/library/dct97kc3.aspx

Application pool recycling default setting in IIS 7 causes invalid state error in ASP.NET


Default setting is 1740 minutes, every 29 hours application poop restart.
If happen in rush hour, will cause a lot of connection are cut off.
Should change this one to third option:  Specific time.

IIS manager -> application pool-> Cycling setting