I ran into a little problem trying to integrate Metabuilders combobox into an asp.net web app I am creating.
The problem was that the onload event handler was not properly firing when smartNav was turned on.
The “InitScript” was as follows:
if ( typeof( window.addEventListener ) != "undefined" ) {
window.addEventListener("load", ComboBox_Init, false);
alert('case 1');
} else if ( typeof( window.attachEvent ) != "undefined" ) {
window.attachEvent("onload", ComboBox_Init);
} else {
ComboBox_Init();
}
Well when you are using smartNav, the window.onload event is only fired the first time you reach the page. So I used this bit of C# in the control to get it to work.
String initScript = resources.GetString("InitScript");
if (this.Page.SmartNavigation)
{
this.Page.RegisterStartupScript("MetaBuilders.WebControls.ComboBox Init with Smartnav", "<script>ComboBox_Init();</script>");
}
else
{
this.Page.RegisterStartupScript("MetaBuilders.WebControls.ComboBox Init", initScript);
}
I had a different solution to the same (or similar?) problem. See http://www.codeproject.com/script/profile/whos_who.asp?msg=989180&id=592585#xx989180xx