Wednesday, December 21, 2005

drop down (select) in HTML, DIV, and a little bit more about it.

to pimp my website with a suggestion text box can be very cool... the meaning behind it is to show suggestions based on user's input. As a AJAX.net fan, I downloaded Michales great suggestion box and have used it in combination with some other controls on my page... eh voila!

have you ever tried to make show a div over a drop-down? Microsoft's MSDN answer sounds like that:


Remarks
-The SELECT element is available in HTML and script, as of Internet Explorer 3.0.

-This element is a windowed control and does not support the z-index attribute or zIndex property.

-This element is an inline element.

-This element requires a closing tag.


so now i still have the same problem like before. but since i get used to display div's i did the following try:

My HTML part looks like that:
<div id="myDivStyle" class="divBoxing">some
more
information

<input id="text" maxlength="30" onfocus="myLoveleySelectBox(true);void(0);" onblur="myLoveleySelectBox(false);void(0);" />
<br/>
<select id="myDropDown" style="visibility:visible;">
<option value="a">A
<option value="b">B
</select>


the css for my suggestion can looks like that (div):
<style type="text/css">
.divBoxing
{
border-right: #000000 3px dashed;
border-top: #000000 3px dashed;
border-left: #000000 3px dashed;
border-bottom: #000000 3px dashed;
line-height: 100px;
line-width:140;
visibility:hidden;
position:absolute;
left:12px;
top:36px;
background-color:Teal;
color:White;
}
</style>


and here the last part, a little bit javascript
<script type="text/javascript" language="javascript">
function myLoveleySelectBox(b)
{
var l = document.getElementById("myDivStyle");
l.style.visibility = b ? "visible" : "hidden";

var l = document.getElementById("myDropDown");
l.style.visibility = !b ? "visible" : "hidden";
}
</script>


enjoy it!

Sample page available at: DivAndDropDown.htm

Sunday, December 11, 2005

Disabling a button for few seconds

I have founded today in my backups the following code:

<script type="text/javascript">
<!--
var secs = 20;
var wait = secs * 1000;
document.sform.submitbtn.disabled=true;

for(i=1;i<=secs;i++)
{
window.setTimeout("update(" + i + ")", i * 1000);
}

window.setTimeout("timer()", wait);

function update(num)
{
if(num == (wait/1000))
{
document.sform.submitbtn.value = "Akzeptieren";
}
else
{
printnr = (wait/1000)-num;
document.sform.submitbtn.value = "Akzeptieren (" + printnr + ")";
}
}

function timer() {
document.sform.submitbtn.disabled=false;
}
//-->
</script>

I don't have written the above code by myself... Anyway
thanks to the writer. Just tested it and its working very
good, in case you want that user reads a your lic. agreement
or anything else.

Wednesday, December 07, 2005

Mulitculiti with CurrentCulture and CurrentUICulture - Localization

to understand when exactly what is happening during the page life cycle is not very difficult but its also not very easy. Anyway, during some tests with the .net 2.0, CurrentCulture and CurrnetUICulture I got the following conclusions:

- CurrentUICulture is exclusively used by the Resource Manager
- CurrentCulture is used by the formatting methods like myDateTimeObject.ToString()

as I received a small example from a friend of mine which contained the following lines to understand this behavior.

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-us");
Console.WriteLine(DateTime.Today.ToString());

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-ch");
Console.WriteLine(DateTime.Today.ToString());

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-us");
Console.WriteLine(DateTime.Today.ToString());

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pt-br");
Console.WriteLine(DateTime.Today.ToString());


well, I have to say; based on those lines i understand where the difference is! Thanks to "XiCoLoKo"

more information you can get at the following article: Localization Practices on TheServerSide.com


In my point of view the best approach will be using the Profile option which is provided by .net 2.0

the following is an extract from the article on theServerSide.com article I have pointed above:

Fortunately, with ASP.NET, a strongly-typed mechanism for storing profile data is available. For example, this web.config setting creates a profile that stores UICulture and Culture settings:

<profile>
<properties>
<add name="UICulture" allowAnonymous="true" />
<add name="Culture" allowAnonymous="true" />
</properties>
</profile>

These settings are accessible through the type-safe Profile object:

Profile.Culture = "it";
Profile.UICulture = "it";

Using profile, we are still faced with a similar challenge as with the Session object: when can we access the Profile for the user during request processing? Unfortunately the Profile is not initialized until the session is acquired, which means we cannot access it through the object model while the cache is inspected. In order to overcome this, the data store where user settings are persisted must be accessed using custom code.

Friday, December 02, 2005

Visual Studio Add-Ins Every Developer Should Download Now

today i found an article on 10 tools for visual studio...

great tools !


http://msdn.microsoft.com/msdnmag/issues/05/12/VisualStudioAddins/default.aspx

enjoy reading and installing of:


TestDriven.NET
GhostDoc
Smart Paster
CodeKeep
PInvoke.NET
VSWindowManager PowerToy
WSContractFirst
VSMouseBindings
CopySourceAsHTML
Cache Visualizer

on the right hand side of my blog you see my favorit tools.

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge