Solved

Set target on ASP.NET button component.

Posted on 2010-09-16
4
725 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

707 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