capturing web form values in WebBrowser class .net compact 2.0

I realize that .net 2.0 compact framework does not support the Document property in the WebBrowser class, which is the straightforward way to, say, detect whether a checkbox in a web from is checked.  I've tried what was suggested in http://msdn2.microsoft.com/en-us/library/ms229657; however, it doesn't work as advertised.  Even when I used the exact code snippets as shown, the Url property of the WebBrowserNavigatingEventArgs was null and did not contain the form values as one would expect from a GET.  Am I just out of luck, or is there a workaround

For example, I have

webbrowser1.DocumentText="<html><body><form method='GET'><input type='checkbox' name='option1'/><input type='checkbox' name='option2'/><input type='submit' /></form></body></html>";

I want to find out if either of the checkboxes was checked.

For reference, I'm using Microsoft Visual Studio 2005 version 8.0.50215.44 (Beta 2).

Thanks,
Deborah


Answer this question

capturing web form values in WebBrowser class .net compact 2.0

  • Action12

    I am seeing the same problem on WM SE device. Looks like a bug.
  • yaoyao

    I was able to get your html working and I don't get any reloads so it means that there is some code in the events are triggering it.
    The events are corrrectly firered when you assign the DocumentText property, so you need to check if the url value is includes some " ". In my case I get:

    about:blank option2=on


  • Diamond.Yu

    Thank you for reporting the issue. We will investigate the cause of the issue and consider fixing the issue in a service pack release.

    Cheers,
    Anthony Wong [MSFT]


  • SQLBOY36

    Try the DocumentCompleted event istead.
  • bebop

    Here is where things started to get really strange.  The original (very simplified) code snippet worked when I looked at either the Navigated or DocumentCompleted event handlers (I had some complicated code in my Navigating event handler that was messing things up before).  However, I still continued to get the DocumentCompleted infinite loop based on the actual content of the html I was trying to display.

    I was finally able to narrow it down to an <img> tag appearing within a table.  For example, this causes the DocumentedCompleted argument to fire repeatedly:

    <html>
      <body>
        <table>
          <tr>
            <td><img src="file://\StorageCard\folder\img.jpg"></td>
          </tr>
        </table>
      </body>
    </html>

    But if I just put regular text in that table cell, then everything is fine.  This is probably a bug, but I can't tell if it's with the WebBrowser class or with the emulator itself.  I'll follow-up to my post on the emulator forum just for good measure.

    Deborah

  • PekChan

    No luck.  The URL still shows up as "about:blank".  In fact, I had to test this on XP because something is wrong either with .NET compact or with the Pocket PC 2003 SE emulator.  When I tried to test it there, as soon as I set the DocumentText property of the WebBrowser instance, the Navigating event fires, then the Navigated event fires, and then the DocumentCompleted event starts firing repeatedly and won't stop.  This causes the page to reload continually; when I manage to sneak in there in between one of the reloads and check one of the boxes, the page reloads again and I lose the checked state.  I'll make a separate post about this issue on the emulator board; however, I still have the problem of trying to capture form values, because the URL doesn't contain any information.

  • Menghraj

    Actually. I have re-tested this in the RTM bits and looks like it's been fixed.

    -Alex

  • RGD_DBA

    Hi AlexY

    I found this website for "RTM bit" and Install 2006 Rtm Pack but my problem not solved.

    my problem is navigating Event return  Url null reference.(windows mobile 2003 Pocket pc)

    Tnx LOT(sorry about my bad english)


  • capturing web form values in WebBrowser class .net compact 2.0