Solved

Set target on ASP.NET button component.

Posted on 2010-09-16
4
719 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 2

Expert Comment

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

Expert Comment

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

Accepted Solution

by:
vsosu earned 500 total points
ID: 33690998

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 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