Wednesday, April 9, 2008

Show message box in ASP.NET

I've written a simple function which uses JavaScript.

private void ShowMessageBox(string Message)

Label lblMessageBox = new Label();

lblMessageBox.Text =

"<script language='javascript'>" + Environment.NewLine +
"window.alert('" + Message + "')</script>";



To call out the message box, just write this:

ShowMessageBox("Hello world!");

The problem with this is that I can't customize the message box. I can only pass in the message as parameter, but not changing the title, the button text or image.
Message box

Wednesday, April 2, 2008

Add javascript dropdownlist in your blog

I was looking for a way to add a dropdownlist in my blog, finally I've found this. Happy It's simple and it's what I want.

I do not know why the above dropdownlist is not working, but when you copy these codes to your blog, it should be able to work.

Just copy the following codes, and add to your blog. In Blogger, Add these codes in HTML/Javascript element, then it works fine.

<!--BEGIN dropdownlist--><script language="JavaScript">
function selectOption(selObj){[selObj.selectedIndex].value);}</script>

<select style="background: #c6e2ff; color: #000000" onchange="selectOption(this)">
<option value="">- Please select -</option>
<option value="">Google</option>
<option value="">Yahoo</option>
<option value="">MSN</option></select>
<!--END dropdownlist-->


I got this script from this blog. Thanks! Happy