by aherrick
20. August 2008 05:08
Okay I was working on testing the Autocomplete Extender on a site I am working on. I noticed something interesting when testing the search functionality. Take a look at what was going on:
Here is what the control source looked like:
As you can see, the SKU codes I was looking for started with "TEST". But if a bunch of junk text was included before the actual SKU, it would stay with it in the dropdown list. I finally found the solution by removing the "DelimiterCharacters" from the control. I hope this works for you!
On an unrelated note I accepted a full time position at Blue Horseshoe Solutions today, I am thrilled.
by aherrick
12. August 2008 23:55
I was working on form submit where I wanted to prompt with a simple Javascript confirm dialog when the user clicks the submit button on the form. Naturally, all the form fields (name, adress, etc.) I setup using required field validators. My custom javascript confirm originally looked like this.
I called the javascript from the code behind.
The big problem I found was that the javascript confirm function was being called regardless of if the page completely validated or not. I wanted the functionality to first validate the page, then if the page was valid, run the custom code. I came up with this code using Page_IsValid. It uses Page_ClientValidate() to validate the page, then I check if the page is valid. Simple yet effective!
Good luck!
by aherrick
8. August 2008 07:08
Today I was working on some code to monitor my network speed (incoming and outgoing). I wrote a windows service to capture my bandwidth and dynamically create an xml file and upload it to my website. Every 30 seconds (time is totally configurable) I override the exisiting XML with an XML containing a fresh capture of my bandwidth speed. How I wote the service is another post for another day... However I do want to share some code I wrote to load the XML and update the text.
Here is an example of the XML file my windows service generates.
The XML file is named bandwidth.xml
I wrote a javascript function to attempt to read the XML file when it is in the same directory as my html file. See javascript function parseXML below.
At the end of the function I make use of setTimeout to call the function again the function after a period of time. In this case every 10 seconds.
I load the Javascript function using the body onload event.
body onload="parseXML()"
I have three span tags in my html. XML, upload, and download. I grab their IDs in the function and use innerHTML to replace the text. Try it out by loading the html in a browser and changing the xml values. Have some fun with it!
Check out the XML and HTML below to see the full code. Good luck!
bandwidth.xml (100.00 bytes)
index.html (1.43 kb)