locked
Problem with PostBackUrl and ImageButton on a Windows Mobile 6 device RRS feed

  • Question

  • User1125515668 posted

    I am currently developing a Windows Mobile capable website with Visual Studio 2008, Framework 3.5. Now the first thing I encounter there seems to be a problem with the ImageButton and the PostBackUrl property.

    To give an example I have the following ImageButton defined:

        <asp:ImageButton ID="btnLog" runat="server" ImageUrl="Images/LogButton.gif" PostBackUrl="~/SystemLog.aspx?SystemId=2" />

    If I run the website inside a 'normal' browser if fires correctly but on a Mobile 6 device it won't go to the other page. For testing purposes I changed it to a normal Button. This works!

    Does anybody have a solution?

    Thanks for any help!

    Evert Wiesenekker 


     

     

    Thursday, June 19, 2008 5:12 AM

Answers

  • User1634317999 posted

    Hello Evert,

    prima facie it looks like it is not possible to use the ImageButton for IE Mobile because input controls of type image have a submit behavior by default in this browser: This means that the whole JScript which the ImageButton uses is ignored. The ImageButton unfortunately has no UseSubmitBehavior attribute like the Button which could be set to false. You can try to ask the IE Mobile Team via its blog.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 19, 2008 9:06 AM

All replies

  • User1634317999 posted

    Hello Evert,

    prima facie it looks like it is not possible to use the ImageButton for IE Mobile because input controls of type image have a submit behavior by default in this browser: This means that the whole JScript which the ImageButton uses is ignored. The ImageButton unfortunately has no UseSubmitBehavior attribute like the Button which could be set to false. You can try to ask the IE Mobile Team via its blog.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 19, 2008 9:06 AM
  • User1125515668 posted

    Thank you for your quick reply! I think I will replace some buttons with the HyperLink control where I don't need to respond to a Button Click event.

    Evert

    Thursday, June 19, 2008 10:09 AM
  • User1634317999 posted

    Hello,

    if you have only one ImageButton you can also try to define the PostBackUrl in a init function with JavaScript:

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
        <script type="text/javascript">
        function init() {
           theForm.action = 'YourUrl;
        }
        </script>
    </head>
    <body onload="init();">
    <form id="form1" runat="server">
        <div>
            <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="YourImageUrl" />
        </div>
    </form>
    </body>
    </html>
    
     
    Friday, June 20, 2008 10:29 AM