[OPEN] [#1251] [2.5] ImageButton and HrefTarget

  1. #1

    [OPEN] [#1251] [2.5] ImageButton and HrefTarget

    I am confused. Why can't an Ext:ImageButton launch it's href in a new browser tab, but a Ext:Button can?

    <ext:ImageButton runat="server" ImageUrl="images/transferFile32.png" Href="transfer.aspx" HrefTarget="_blank" />
    It always launches the new URL in the same browser tab.
    Last edited by fabricio.murta; Feb 03, 2016 at 5:48 PM.
  2. #2
    Hello Chris!

    ImageButton is a custom Ext.NET-specific control, and it is built on top of the IMG Element. Furthermore, it does not accept the AutoEl setting to turn it into an A element.

    It seems the IMG element itself does not (or should not) support the href attribute at all. Now I am confused as to why it actually works on IE. :) We probably have to remove this setting from Ext.NET as it is really misleading. Either this or wrap an <a> tag around an ImageButton component (like the button component is).

    Well, for now, you have to rely on this:
            <ext:ImageButton runat="server" ImageUrl="../images/file_transfer.jpg">
                <Listeners>
                    <Click Handler="window.open('transfer.aspx', '_blank');" />
                </Listeners>
            </ext:ImageButton>
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello again, I hope the code above helps you handle your problem! I've created an issue in out bugtracker so we can fix this problem!

    The issue is #1251.
    Fabrício Murta
    Developer & Support Expert
  4. #4
    By the way, if you are using just a static image on the button (it does not have hover, press and depress effects), you should be actually using an HyperlinkImage like the last entry in this example: https://examples2.ext.net/#/Form/HyperLink/Basic/

    It opens in a new tab as expected, and creates under the correct <a> element.

    For the button effects example, they are here: https://examples2.ext.net/#/Buttons/Basic/ImageButton/ (this is the ImageButton with lack for HrefTarget= support)
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] Hyperlink's HrefTarget doesn't work
    By RCN in forum 3.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 20, 2015, 1:04 PM
  2. ImageButton and the SuppressEvent value
    By IFLOW in forum 2.x Help
    Replies: 5
    Last Post: Apr 15, 2013, 10:58 PM
  3. Replies: 2
    Last Post: Aug 17, 2012, 9:28 PM
  4. Problem with imageButton
    By joao.msdn in forum 1.x Help
    Replies: 3
    Last Post: Apr 23, 2010, 11:24 AM
  5. Refresh ImageButton
    By Maia in forum 1.x Help
    Replies: 9
    Last Post: Jan 12, 2010, 1:49 PM

Posting Permissions