AjaxControlToolkit ComboBox.Text User Entered Value is Missing When Enter Key is Pressed also the on change events are not called

by jasonvonruden 10. June 2010 04:55

The Issue

The AjaxControlToolkit ComboBox has a .Text attribute and a couple of server side events OnSelectedIndexChanged and OnTextChanged to deal with field changing.

However  the user entered value is missing in the .Text attribute on an enter key press and the “on change” events events are not called.

 

Issue Code Example:

private void BuildFileListDetails(NHibernateDataProvider _providerM)
{
    int resultsPage = Convert.ToInt32(ddlNavPageNumber.Text); 
    const int RESULTS_PAGE_SIZE = 100;
 
    //The Problem: AjaxControlToolkit ComboBox.Text User Entered Value Missing When Enter Key Pressed.
    string searchFileName= cbFileName.Text;  // The cbFileName.Text equals ""
 
    var xrfFiles = _providerM.GetXrfFiles(searchFileName, resultsPage, RESULTS_PAGE_SIZE);
    gvXrfFileList.DataSource = xrfFiles;
    gvXrfFileList.DataBind();
}

The Solution

You need to access the AjaxToolkit "ComboBox" imbedded TextBox control's .Text to access the value entered by user.

I ended up creating Utility Method to fix this issue that is executed before first use of the ComboBox.Text property. Since the AjaxToolKit ComboBox has a drop down sub component, I needed to check the drop down list to see if the new value already exists in the list and add it if it is missing before assigning the new text value.

Solution Code Example:

//*****************************************************************
// Fix AjaxToolKit ComboBox Text when Enter Key is pressed bug.
//*****************************************************************
public void FixAjaxToolKitComboBoxTextWhenEnterKeyIsPressedIssue(AjaxControlToolkit.ComboBox _combobox)
{
  TextBox textBox = _combobox.FindControl("TextBox") as TextBox;
  if (textBox != null)
  {
      if (_combobox.Items.FindByText(textBox.Text) == null)
      {
          _combobox.Items.Add(textBox.Text);
      }
      _combobox.Text = textBox.Text;
  }
 
 
/*****************************************************************
/ Build File List Details.
/*****************************************************************
rivate void BuildFileListDetails(NHibernateDataProvider _providerM)
 
   int resultsPage = Convert.ToInt32(ddlNavPageNumber.Text); 
   const int RESULTS_PAGE_SIZE = 100;
 
   FixAjaxToolKitComboBoxTextWhenEnterKeyIsPressedIssue(cbFilename);
   string searchFileName = cbFileName.Text;
 
   var xrfFiles = _providerM.GetXrfFiles(searchFileName, resultsPage, RESULTS_PAGE_SIZE);
   gvXrfFileList.DataSource = xrfFiles;
   gvXrfFileList.DataBind();
 

Tags:

ASP.NET

Moving Existing Wordpress Blog on Linux to Windows Hosting

by jasonvonruden 18. April 2010 12:20

 

After purchasing new windows web hosting for several new ASP.NET websites. I decided to also transferring my existing Fantastic Freeware Wordpress Blog that was hosted on the Linux Platform onto my new Windows based Hosting.  My preferred option was to convert the Wordpress blog to BlogEngine.NETusing BlogML XML format, but I ran into a lot of conversion issues. (See below)

The Bottom Line

In the end decided to move Fantastic Freeware Wordpress blog as is from Linux hosting to Windows Hosting with 404 redirect, because the default hosting company’s 404 redirect is prevents url rewriting from working.

Options

Problems

  • The WordPress BlogML Export 1.0a for BlogML 2.0 is creating a BlogML XML file that is not compatible with the BlogEngine.NET import process which must be using BlogML 2.1Now it looks like I am going to have to dive into the source code and the XML. 
  • The RSS import was not an option because the blog has over 3000 entries and Search Engine Optimization (SEO) principles the URL must remain the same after the conversion.
  • The default hosting company’s 404 redirect was preventing url rewriting from working.

Tags: ,

ASP.NET | Wordpress

The Easy Way to Setup Wordpress on Windows Hosting with Permalinks

by jasonvonruden 18. April 2010 12:11

If you search for how to setup a Wordpress blog using permalinks on windows hosting you will find a lot of hits referring to url rewriting which is very complex and confusing.

In the end going down the url rewriting path is a waste of time especially if you hosting company has a custom 404 redirect in place.

If you are still interested in url rewriting, please see my other blog entry about setting up a Wordpress Blog on Windows Hosting using Managed Fusion URL Rewriter

How-To Get Wordpress Permalinks working on Windows Hosting: 

  1. Install and configure Wordpress as you normally would, including your permalink settings.
  2. To get permalinks to work correctly with no url rewriting needed, change in the hosting control panel the 404 redirect to point Wordpress’s index.php.

That’s It!

Tags: , ,

ASP.NET | Wordpress

BlogEngine.NET Setup and Customization Adventures

by jasonvonruden 12. April 2010 20:46

The main reason that I picked BlogEngine.NET as the blog software for this website is because it is lightweight and easy to use.  I also found it is easy to customize the master page and CSS template to fit my needs.  The website was going to be a development blog so the Windows Live Writer and code snippet plug-in was a requirement.  I am planning to use the BlogML which is an open format derived from XML to store and restore the content of a blog to convert my Fantastic Freeware website from a Wordpress blog to BlogEngine.NET blog. 

 Customizations

What Did Not Worked

  • Converting ASP.NET Website into ASP.NET Web Application. It worked, but extensions feature no longer works, Dropped it because, it had no practical benefit.
  • Wordpress to Blogengine.NET conversion issues.  The WordPress BlogML Export 1.0a for BlogML 2.0 is creating a BlogML XML file that is not compatible with the BlogEngine.NET import process which must be using BlogML 2.1Now it looks like I am going to have to dive into the source code and the XML. (More on this in a future Post)

 

What Still Does Not Work

  • Resolved:  Windows Live Writer Issue: No spell checking (Firefox) - (Editor brakes Firefox's spell check feature) 

Tags: , ,

c# | General | Wordpress | ASP.NET