Thursday, September 29, 2011

Register Javascript variables OnLoad from server side

Started out for a way to find ClientId of Asp.Net Button in javascript code.

Interesting find is Page.ClientScript.RegisterClientScriptBlock() which registers variables and allows them to use in javascript on client side.

Sample:
Do the following on Page_Load Event of any page

 var RegisteredVar= string.Format("var _Button1ClientId='{0}';", Button1.ClientID);              Page.ClientScript.RegisterClientScriptBlock(GetType(), "AddScriptVariables", RegisteredVar, true);


Good to use the variable "RegisteredVar" in any javascript function.


Friday, September 23, 2011

Remote Debugging Visual Studio 2010

Finally was able to get it working!



1) Copy the appropriate installer from http://www.microsoft.com/download/en/details.aspx?id=475 onto your local VM

2) Install it and make it a accessible over the network(Create a share)
3) Add yourself to the Administrators group in remote computer(assuming you are logging into the host as yourself)
4) Run the msvmon.exe on remote machine as Administrator
5) Copy pdb files to shared folder on remote machine and load symbols in visual studio from that shared folder
6) Stop all the servers in load balancing environment, just have the remote machine running
7) Stop IIS on remote machine and clean up temporary asp.net files and restart IIS (This might not be needed, cleaning temporary asp.net files didnt work for me so went this way. It is not documented anywhere to do this way, just my way of doing it)
8) Copy the server name(usually DOMAIN\administrator@REMOTEMACHINE) into qualifier in visual studio
9) Find the right process and attach it, you should be good to go.




Just be persistent, it took me a week to figure this out!

Friday, September 16, 2011

Wednesday, September 7, 2011

FXCOP download

http://blog.rodhowarth.com/2010/08/general-dev-how-to-download-fxcop-100.html

Jquery live() not working in IE, event bubbling issue and workaround for that using livequery()

http://blog.bigbinary.com/2009/10/14/how-live-method-works-in-jquery-why-it-does-not-work-in-some-cases-when-to-use-livequery.html