Monday, July 31, 2006

PostBack and selection in DropDownList control (ASP.NET 2.0)

Sometimes a simple task can take plenty of time. And today I tried to use DropDownList control without ViewState (in other words - by "manually" populating the combobox on each page loading). By some reason, DropDownList control is not raising SelectedIndexChanged event if EnableViewState is False, and I'm not sure how to do it properly in ASP.NET way...

As workaround I used the control-name/value pair for the drop-down which is passed in HTTP POST parameters (when form is submitted). Control-name is UniqueID property of the drop-down, and the value contains the selected item.

So to restore the selection I used:
_combo.SelectedValue = Request[_combo.UniqueID];

Let me know if you know a better solution.

Labels: , ,

Sunday, July 23, 2006

Compiling boost 1.33.1

Today I decided to update the boost library on my machine. And I got a strange error in attempt to compile Boost.Jam (bjam):
G:\boost_1_33_1\tools\build\jam_src>build
\Utilities\Bin\x86 was unexpected at this time.

The problem was solved after (temporary) removing the following path
from PATH environment variable:
H:\Program Files\Microsoft DirectX 9.0 SDK (October 2005)\Utilities\Bin\x86;

Seems like build.bat (or callee of it) do not like scopes in the PATH.

Labels: ,

Monday, July 10, 2006

Cleaning up web cache for Visual Studio 2003

Web cache in Visual Studio 2003 (maybe in VS2002 as well) can give you some unpleasant moments. In my case, two branches of the same project behave differently if you compile them manually, and unexpectedly similar if compiled automatically (by NAnt). The reason of the problem was a cached assembly...

Visual Studio 2003 saves cached versions of your web projects in Web Cache directory. And if you are getting strange errors while opening your project, maybe it worth to clean up the cache.

The cache usually located at C:\Documents and Settings\username\VSWebCache. The path can be customized, and stored in registry under
HKCU\Software\Microsoft\VisualStudio\7.1\WebProject\OfflineCacheDir.

Here is a small NAnt snippet to cleanup web cache (VSWebCache) for the current user. It takes path to the cache from the registry, and delete the whole directory for the current user.

NOTE: you'll lose some of you user settings of your web projects, but automatic build will work correctly. But be sure you know what are you doing ;)

<readregistry property="vs_web_cache" key="Software\Microsoft\VisualStudio\7.1\WebProject\OfflineCacheDir" hive="CurrentUser">

<delete dir="${path::combine(vs_web_cache, environment::get-machine-name())}" failonerror="false">

Labels: , ,

Tuesday, July 04, 2006

Flash player and textboxs in Firefox

Problem


Open a HTML page with a textbox and Flash Player in Firefox (FF1.5 and FP8.0). The textbox became locked if you hit Stop button in the Flash Player. It looks like focus is still in the text box, but it's impossible to type anything.
The same page works fine in Internet Explorer 6.0.

Solution


It's not mine solution, I found it here http://www.easterndesigner.com/forum/viewtopic.php?t=87. The solution was for another problem, but it works for locked textboxes as well.

You should set wmode as transparent in object's params and in attributes for embed tag. Also embed should be styled as style="z-index:inherit".

So the final code should looks something like:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
 codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
 width="300" height="200" align="middle" >
 <param name="movie" value="foo.swf" />
 <param name="quality" value="high" />
 <param name="wmode" value="transparent" />
 <embed src="foo.swf" wmode="transparent" quality="high" width="300"  height="200" style="z-index:inherit" align="middle"  type="application/x-shockwave-flash"  pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

Labels: ,