Thursday, February 5, 2009

centralised blog

Hi all,

I have compiled all the entries in the sharing in

http://dinorex.no-ip.biz/blog/

therefore, the new entries will be added down there instead. Interesting parties can visit my current blog for the latest entries :)

Friday, November 14, 2008

make migrated .NET 3.5 web apps from 1.2 to be truly supported by multi-browsers

when you migrate the web applications from .NET 1.2 to version 3.5 you will discover all validator controls are not functioning at all in non-IE environments (that's the same for all web applications developed in .NET 1.2 )

I have used one whole night to google, and found out the following workaround

source : http://forums.asp.net/t/1283702.aspx

Put it simply, in 'Web.Config', delete the following line: -

'<'xhtmlConformance mode="Legacy"/'>'

quote from the original source: -

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

set in your web.config, then client-side validation is disabled in firefox.

To see why, we have to jump down into the validation framework that ASP.Net sends to the web browser. The actual Javascript validation function looks like:

function ValidatorValidate(val) {

val.isvalid = true;

if (val.enabled != false) {

if (typeof(val.evaluationfunction) == "function") {

val.isvalid = val.evaluationfunction(val);

}

}

ValidatorUpdateDisplay(val);

}

Using Venkman, I was able to see that val.evaluationfunction wasn't a function at all, therefore the page wasn't getting validated because of this. A bit more searching found that this evaluationfunction is an expando attribute. In ASP.Net v1, this expando is an IE-only HTML expando, defined directly in the HTML markup. In ASP.Net v2, this is a Javascript expando attribute, defined on the DOM via Javascript, and therefore compatible with both IE and Firefox.

For example, the RequiredFieldValidator calls RegisterExpandoAttribute. You can call this method yourself like:


Page.ClientScript.RegisterExpandoAttribute(TextBox1.ClientID, "value", TextBox1.Text);

This produces a block of Javascript just before the closing tag like:


'<'script type="text/javascript"'>'

'<'!--

var TextBox1 = document.all ? document.all["TextBox1"] : document.getElementById("TextBox1");

TextBox1.value = "";

// --'>'

'<'/script'>'

where "value" has become the new expando attribute. In the case of the RequiredFieldValidator, the expando name is" evaluationfunction" and it is added to the representing the control at runtime.


It turned out that this block of Javascript wasn't being sent to Firefox in my situation, and I didn't know why. Instead, the evaluationfunction expando attribute was being rendered directly on the element in HTML.


So after good deal of decompilation using Reflector, and debugging using Reflection Invokeing of private methods, I discovered the problem was that RegisterExpandoAttribute checks the XHTML Rendering Mode prior to generating the Javascript and if that rendering mode is set to Legacy, then the expando is rendered directly onto the element and no Javascript code is rendered. The result of this is to prevent Firefox from performing client-side validation when Legacy XHTML mode is set.


I have no idea why the ASP.Net team chose to do this for validation. Perhaps the Legacy XHTML setting should have been called "ASPNetv1Conformance" because that's actually what it does. The docs for Legacy mode state:


"Reverts a number of rendering changes made for conformance to the v1.1 rendering behavior."

Sunday, October 19, 2008

My web site is built

I have bulit a web site: -
http://dinorex.no-ip.biz/

and have a demo for my recently written real estates management system.

For the demo link and demo login info, please feel free to contact me directly via email (i.e. dinorex@dinorex.no-ip.biz)

Enjoy !

Friday, June 8, 2007

Symantec Antivirus Corporate Edition 10

Today when I tried to uninstall this guy in a particular machine, it returns "Fatal Error During Installation" halt and no go.

Further investigations reveal that the LiveUpdate (version 2.6) is not working properly and returns this error.

Therefore the workaround is to uninstall the LiveUpdate first and then next to SAV CE 10.

Hope this can solve some of the people worries.... XD

Friday, May 25, 2007

Little Introduction of myself

I am a gadgeteer: Zaurus Linux PDA, Windows Mobile (PocketPC), Palm, Mac OS X, Windows XP, Windows 2003 ...

Therefore, inside this web-log, many techniques dealing with these kinds of stuff will be seasoned....

For my current job, I am a C# / ASP.NET and Coldfusion developer, so some techniques for them are also discussed....

Stay tuned.....

Thursday, May 24, 2007

A mixture feeling....

This is a new web-log.
However, I have another old web-log which is in Chinese / English.

Therefore, the functionality of this web-log may be different from my origin first blog which is dealing the sharing of incidences, while this web-log may rest upon the technical information sharing (in my expertise - IT-related).

Hope this web-log can be a good referee to my career.

PS. the original web-log (http://dinorex.mocasting.com) is still functional....

[C#] Loading and reading the Microsoft Excel file contents using C#

If you are not lazy, you can search the following CodeProject via Google within seconds: -
http://www.codeproject.com/useritems/Excel_Application_in_C_.asp
This mechanism can be used, but it has some considerations: for your deployment, you need to apply the Office component (which is using Microsoft.Office..blah blah blah..Excel, instead of the mentioned using Excel; ~!) to read the cells, that means, the deployment machine needs to purchase an extra Office licence for the deployment - most of the small businesses are reluctant to do so.. moreover, since this Office Object is version dependent, when the developer has an office version different from that in the client site, a nightmare .. XD
Therefore, you must ask: How can I accomplish that goal then?..
The answer is: SIMPLY USE StreamReader to directly read the file LINE BY LINE!..
If you don't trust me, you can try it yourself by setting similar Console App and you 'll get amazing results~!
This workaround is valid even for Visual Studio 2003, and the behind scene mechanism of that fussy StreamReader Object is a mystery to me..