SmartNavigation with Metabuilders Combobox

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);
}

 

Extending the Atlast AutoComplete Extender

I have been looking at the new “Atlas” controls, which MS has brilliantly (sarcasm) decided to rename “ASP.NET AJAX”.

The one control I have been most interested in is the autocomplete extender.

I want to use something like this, not to help populate a textox, but instead to allow the user to type a few characters in to narrow down the list of options, rather than showing them a dropdown of 10,000 items.

In otherwords, when they are done with the control, I don’t want the text in the textbox, I want the database ID value behind it, and i also don’t want to let them type in just anything they want, but rather limit their options to what is in the autocomplete options.

I found another blog post where someone is extending the autocomplete behavior:

http://aspadvice.com/blogs/garbin/archive/2006/01/02/14518.aspx

 

PostBackUrl And SmartNavigation Bug?

I have a page with SmartNav, that contains a linkbutton with a
PostBackUrl.

I have found that the page that is the target of the PostBackUrl will
have it’s postback property fired 2 times, and unfortunately, the 2nd
time it is fired the “PreviousPage” is set to Nothing.

I have posted a few places to see if someone from MS can confirm this is a bug, but  I am betting they are going to tell me to not use smartnav.

Using Postbacks in ASP.NET From showModalDialog pages.

If you have an ASP.NET page (.aspx) opened with the JavaScript showModalDialog() function and inside that page there is a form doing PostBack, when the PostBack is being done the page loads in another (popup) window. The easiest way to prevent this is to add the following tag inside the <HEAD></HEAD> tags of the ASP.NET page:

<base target=”_self”>

From: http://www.geekpedia.com/Question23_Using-showModalDialog()-with-an-ASP.NET-page-that-does-PostBack-opens-another-window.html

Databinding "Bind()" in ASP.NET

If you used the developemt tools to create a datagrid in ASP.NET 2.0, it will show something like:

NavigateUrl=’<%# Bind(“EmployeeId”) %>

But what if you wanted to do something more complicated that just ge the EmployeeId into the field, like for example if you wanted to run a JS function.  Then you have to do away with Bind and use the more verbose DataBinder method like this: 

NavigateUrl=’<%# “javascript:UseThisJobIndex(” & DataBinder.Eval(Container.DataItem,”JobIndex”) & “)” %>

That’s all there is to it.

 

Here Is A Article Talking About The Ability To Put Some Of Your Config Info In Another Config File When Using Aspnet

Here is a article talking about the ability to put some of your .config info in another config file when using asp.net

http://www.beansoftware.com/ASP.NET-Tutorials/Multiple-Config.aspx

What I found most interesting is that it says that changing the otherFile.config will not reset your app.

I am guessing that it also means that it won’t find your new values until the app is reloaded, but if it DID find the new values w/o a reload that would be great.

<?xml version=1.0?>
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <compilation debug=false strict=false explicit=true />
    </system.web>
    <appSettings file=externalSettings.config/>
</configuration>

I also wonder if you could have more than 1 appSettings external file.

Activate Flash, Movies, and other ActiveX controls

Recently Microsoft lost a patent judgement, which resulted in them pushing down an “update” to IE that forces you to click on any embedded object to “activate” it.

Embedded objects can be flash movies, video clips, audio, etc.

This is really bad for sites that use flash.  Things like navigation and rollovers don’t work until you first click on them.

This article talks about the work around, and how you can incorporate this into your ASP.NET projects.

http://www.codeproject.com/aspnet/IEActiveXActivation.asp