Wednesday, June 8, 2011

How do I turn on off a checkbox with JQuery or Javascript?

For specific checkbox:
$("form #mycheckbox").attr('checked', true);
$("form #mycheckbox").attr('checked', false);

How to solve “The ObjectContext instance has been disposed and can no longer be used for operations that require a connection”

Convert your LINQ query result into array or iList:

                return query.ToList();

                return query.ToArray();


How to detect iframe src / URL change event by javascript?

By onload event in iframe:

<iframe src="" onLoad="alert('Test');"></iframe>
<iframe src="/test.html" onLoad="alert(this.contentWindow.location);"></iframe>

aspx2razor, a tool to convert WebForm to Razor

aspx2razor.exe c:\MyProject\MyViews\*.cshtml MyOutputDirectory -r