Tuesday, March 24, 2009

javascript code not working when using updatepanel?

I have some javascript code gets executed when window.onload is fired. It basically modifies the appearance of my server controls. Everything works fine before I placed my server controls in an updatePanel(ASP.NET).

When the page got partially rendered(i.e. I clicked the button which is inside the updatePanel to cause a postback), the javascript code didn't work anymore.

I haven't delve into this issue to completely understand this, but I found a solution. It is to use PageRequestManager to register the javascript function I'd like to call each time there is a postback(async or sync). The code is:
function load() {
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(javascriptFuncName);
}
Then add onload="load()" to body tag.

For reference:http://msdn.microsoft.com/en-us/library/bb311028.aspx(Sys.WebForms.PageRequestManager Class)

Wednesday, March 18, 2009

Web page gets messy in IE6



The problem: Using background inside frames.
The solution: Use img instead of background and set its z-index properly.

Setup IIS for ASP.NET projects

1. Make sure .Net Framework and IIS are installed.
2. Register ASP.NET with IIS by executing ASPNET_REGIIS.EXE -i Use the one from version 2.0 (i.e. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727)
3. Make sure ASP.NET 2.0 is the default framework:
1)Open IIS
2)Right-click on the default web site and click 'properties'.
3)Click on the ASP.NET tab.
4)Select ASP.NET 2.0 as the default version.
5)Repeat for the target web virtual directory
4. Click on Web Service Extensions and mark ASP.NET v2.0.50727 as 'allowed'. (For IIS 5.1, ignore this)
5. Right Click on the virtual directory - select properties and then click on "Create" next to the "Application" Label and the textbox. It will automatically create the "application" using the virtual directory's name. Now the application can be accessed.

Sunday, March 15, 2009

Coninental ticket number on eTicket Boarding Pass

My eTicket has 14 digits while the ticket number of Continental is 13 digits which starts with 005. Just ignore the damn last digit.

Tuesday, March 10, 2009

Making a table scrollable

The whole point is to make an html table(asp.net table or whatever is rendered as an html one) sitting inside a div element that has overflow attribute set to "auto" or "scroll".

For example:
<div style="border-style: solid; overflow: scroll; height: 100px; width: 100px;">

<asp:table id="table" runat="server" borderwidth="1px" width="100%">

</asp:table></div>

asp:Panel is render as div, we can also use it:


<table border="1" width="100%">

<tbody><tr><td>stuff</td>

<td>more stuff</td></tr>

<tr><td>stuff</td>

<td>more stuff</td></tr>

<tr><td>stuff</td>

<td>more stuff</td></tr>

<tr><td>stuff</td>

<td>more stuff</td></tr>

<tr><td>stuff</td>

<td>more stuff</td></tr>

</tbody></table>


Just aware that we need to set the "CssClass" attribute for asp:Panel (not "Style", not "overflow"). Same technique should be able to make other control scrollable (e.g. GridView).