"jQuery.support.opacity is null or not an object"

So you are one of those jQuery newbies who get baffled with such maddening errors :). Me too! One thing to remember while working with jQuery in Visual Studio, the vsdoc.js file is solely built for jQuery intellisense at design time for we intellisense-ridden folks. It should not be used at runtime because doing so might result in unexpected errors as the one mentioned in the title. So the solution for the above mentioned error.. remove the reference to the vsdoc.js file from your page and run it.

Also just for sanity check, if you happen to use ASP.NET MVC, by default, when you drag the jquery files onto the Master Page for example, they are added as below

<script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>

The ../../ prefix might create problems for the child pages. The child pages would not be able to refer to the script files referenced like this. Get rid of the ../.. so that it looks as below

<script src="/Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>

Happy Programming!

Just a sanity check : ViewState vs PostBackData

Surprisingly, I have come across quite a few ASP.NET developers who misjudge the exact concept of a ViewState. So here is a really simple and stupid scenario. You have the following things on a ASP.NET page –:

- ASP.NET Textbox

- ASP.NET Button (which just does a postback)

So you load the page, enter some value in the textbox and click the  Button. Of course, that value in the textbox persists after postback. Now disable the ViewState of the textbox. Enter some value in the textbox again and click the Button. I have heard many folks confidently saying that there would be no text in that textbox, which is freggggginnn WRONG! The text will be there.

Explanation –:

ViewState has nothing to do with what you enter in an ASP.NET page while it is running. ViewState stores only the following 2 things –:

- Programmatic change to the properties of a control

- Dictionary storage for any value to be persisted across postbacks i.e. in ViewState[“key”].

The stuff entered in a textbox is persisted due to something called as the LoadPostBackData event during a Page life cycle. As a matter of fact, the data entered inside that textbox is stored within that page like the ViewState but is not a part of the ViewState. During the LoadPostBackData event, this value is picked up and assigned to the textbox.

If I am sounding nuts, please visit this detailed and point accurate explanation here http://www.codeproject.com/KB/aspnet/aspnetviewstatepagecycle.aspx.

Order of classes in CSS file matter to jQuery?

Its no surprise that jQuery is becoming the latest poison for all Web Developers these days. I am no JavaScript expert, but jQuery makes even a scripting chimp like me to do some cool stuff without writing too much script! I had been playing with this library for some time and came across this small issue which took about an hour of head scratching. In my jQuery, I was adding a hover class to a <div> element. Here is the <div> as in the markup.

<div id="myDiv" class="Sample">

Here is the Sample class

background-position: 0px -141px;
Here is another class which I am going to add with jQuery.

background-position: 0px -218px;

And finally, here is my jQuery,


This did not work until I figured out why!!!! In my CSS file the Sample-hover class was declared before Sample class. Due to this, the CSS properties were not being overridden as expected. Phew!! I wished I was a good at these things. Sigh!!

Silverlight z-index not working!

Hahhahaha, I know the answer to this :)). Ok, enough being a jerk. Basically Silverlight would not entertain z-index parameter which is assigned to the object tag until it has a parameter Windowless set to true. Here is a typical object tag which works with z-index as –1 on it.

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%" style="z-index:-1;">
<param name="source" value="ClientBin/SilverlightApplication4.xap"/>
<param name="onerror" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="2.0.31005.0" />
<param name="autoUpgrade" value="true" />
<param name="Windowless" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>

Although there is one caveat here, while creating a Silverlight object using the createObject method, be sure to use the parameter name isWindowless and not Windowless.


Sleek JavaScript search box for Live Search

May be I am a little late in talking about this :), but Live Search provides a really elegant solution for embedding search functionality on your site. Here is the link http://www.bing.com/siteowner . Here is a snapshot taken on my Vista.



It allows you to search sites you mention. You can add your own sites which you have created and Live Search would crawl them. It is just few lines of JavaScript and some markup which can be customized to change the look and feel of the box.

Happy Programming!