Solved

Set target on ASP.NET button component.

Posted on 2010-09-16
4
685 Views
Last Modified: 2012-05-10
I have an ASP.NET Link button which I am using to redirect a user to another page. The link button is located within an IFRAME so I set the target to '_parent' in order for the redirect to affect the overall webpage. This all works fine, however the styling of the link button is causing an issue and it is preferred that the Link Button is replaced with a standard button. I have replaced the component and am using the PostBackUrl attribute to define the redirect path BUT the problem comes with making the ASP.NET button redirect the entire page and not just the iframe contents. Anyone know how I can cause a Button to redirect an entire page rather than just the iframe that contains it - in the same way as declaring the target attribute with a Link Button.
0
Comment
Question by:Blowfelt82
  • 3
4 Comments
 
LVL 2

Expert Comment

by:vsosu
Comment Utility
Use OnClientClick attribute and use javascript with return false to reload page.
Example:
OnClientClick="redirectme();return false;"
0
 
LVL 2

Expert Comment

by:vsosu
Comment Utility
use return false to avoid reload of current page.
0
 
LVL 2

Accepted Solution

by:
vsosu earned 500 total points
Comment Utility

Code Snippet:

<script language="javascript">

    function redirectme() {

        var f = document.getElementById('frame1');

        f.src = "//www.microsoft.com";

    }

</script>



<iframe id="frame1" name="frame1" src="Default.aspx"  width="100px" height="100px"></iframe>

Open in new window

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now