This project has moved and is read-only. For the latest updates, please go here.

[Websample] Resolution combobox empty after browser refresh in index2.htm

Mar 23, 2016 at 8:58 PM
Edited Mar 23, 2016 at 9:01 PM
Hi Saraff,

On index2.htm (Websample) after I click my browser's "refresh" button, the resolution combobox (dpiSelect) is empty, how can this be fixed?


Thanks in advance.

Mar 23, 2016 at 9:12 PM
Edited Mar 23, 2016 at 9:16 PM
I placed this code ("TEST CODE") on SelectDS() function to get the __GetResolutionCount(). First time page loads it returns "5", after browser refresh it returns "-1":
function SelectDS() {

            /*******************     TEST CODE  *************************************/
            alert(__GetResolutionsCount()); // <------- DISPLAY RESOLUTION COUNT

            document.getElementById("dpiSelect").length = 0;
            for (i = 0; i < __GetResolutionsCount() ; i++) {
                document.getElementById("dpiSelect").options[document.getElementById("dpiSelect").length] = new Option(__GetResolutionValue(i), i);                
            document.getElementById("dpiSelect").selectedIndex = __GetCurrentResolutionIndex();
Mar 24, 2016 at 12:18 AM
Edited Mar 24, 2016 at 12:21 AM
Even if I fill "dpiSelect" items manually, button "Acquire" will not work when clicked:
if (document.getElementById("dpiSelect").length <= 0) {
                //alert('No dpi items');
                document.getElementById("dpiSelect").options[0] = new Option("75", "0");
                document.getElementById("dpiSelect").options[1] = new Option("150", "1");

                document.getElementById("dpiSelect").selectedIndex = 0;
Any help would be appreciated.
Mar 24, 2016 at 12:42 AM
I tried AxHost.Dispose() and still not working:
window.onbeforeunload = function (e) {
            //return 'Dialog text here.';
Mar 24, 2016 at 4:24 PM
Hello, smtrejo.
In the example assumed in advance that the page will not be refresh. Refreshing the page (including transitions back / forward), often leads to incorrect operation of the application.
Marked as answer by smtrejo on 3/24/2016 at 8:48 AM
Mar 24, 2016 at 4:52 PM
Thank you Saraff, I noticed that if a new window is opened (instead of refreshing the page) the component will load normally, I'll try that approach embeding the scan page into a frame inside the ASPNET form.

Best regards.

Santiago Trejo