473,788 Members | 2,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Click button and redirect to new page?

Hello,

in an ASP.net / VB page i created a form with a button. When the button is
clicked i want to redirect to a new page. I have the following:

....
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<script runat="server">
void goToPage(object sender, System.EventArg s e)
{
Response.Redire ct("inscricoes-explicadores-step01.aspx");
}
</script>
<html>
....

and

<asp:Button CssClass="butto n" ID="iniciar" runat="server" OnClick="goToPa ge"
Text="Iniciar Inscrição" ToolTip="Click Buttono" Width="140" />

I get this error:

Compiler Error Message: BC30188: Declaration expected.
in line: void goToPage(object sender, System.EventArg s e)

Can you tell me what am i doing wrong and what should i do to fix it?

Thank You,
Miguel
Nov 18 '05 #1
3 40739
Hi,

Your page is VB.NET and you are writing C# or Java script code as server
side block. you should change your server side script to VB.NET.

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Miguel,

You could easily accomplish this in a simple client-side HTML button with an
onclick event:

<input type="button" value="Click Me!"
onClick="locati on.href='inscri coes-explicadores-step01.aspx';">

Of course, if you wanted to be able to have dynamic control over the
destination or re-use the code, it would get a bit more complicatied.
Perhaps you could write a control that does the same thing with client-side
script.

-John
"Miguel Dias Moura" <in************ @27lamps.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Hello,

in an ASP.net / VB page i created a form with a button. When the button is
clicked i want to redirect to a new page. I have the following:

...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<script runat="server">
void goToPage(object sender, System.EventArg s e)
{
Response.Redire ct("inscricoes-explicadores-step01.aspx");
}
</script>
<html>
...

and

<asp:Button CssClass="butto n" ID="iniciar" runat="server" OnClick="goToPa ge" Text="Iniciar Inscrição" ToolTip="Click Buttono" Width="140" />

I get this error:

Compiler Error Message: BC30188: Declaration expected.
in line: void goToPage(object sender, System.EventArg s e)

Can you tell me what am i doing wrong and what should i do to fix it?

Thank You,
Miguel

Nov 18 '05 #3
That's what i am looking for.

Thanks,
Miguel

"John Amick" <an*******@disc ussions.microso ft.com> wrote in message
news:#g******** ******@TK2MSFTN GP11.phx.gbl...
Miguel,

You could easily accomplish this in a simple client-side HTML button with an onclick event:

<input type="button" value="Click Me!"
onClick="locati on.href='inscri coes-explicadores-step01.aspx';">

Of course, if you wanted to be able to have dynamic control over the
destination or re-use the code, it would get a bit more complicatied.
Perhaps you could write a control that does the same thing with client-side script.

-John
"Miguel Dias Moura" <in************ @27lamps.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
Hello,

in an ASP.net / VB page i created a form with a button. When the button is clicked i want to redirect to a new page. I have the following:

...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<script runat="server">
void goToPage(object sender, System.EventArg s e)
{
Response.Redire ct("inscricoes-explicadores-step01.aspx");
}
</script>
<html>
...

and

<asp:Button CssClass="butto n" ID="iniciar" runat="server"

OnClick="goToPa ge"
Text="Iniciar Inscrição" ToolTip="Click Buttono" Width="140" />

I get this error:

Compiler Error Message: BC30188: Declaration expected.
in line: void goToPage(object sender, System.EventArg s e)

Can you tell me what am i doing wrong and what should i do to fix it?

Thank You,
Miguel


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4804
by: yfng | last post by:
In a web form, I want the user clicks on one button and this button will trigger another button/link which will open a new browser window? How to do that? Is there any method like Button.performclick? Thanks
1
1894
by: Hrvoje Vrbanc | last post by:
Hello all, here is what I'd like to do: I have an ASPX page with certain buttons that opens in its window, naturally. When any of those buttons is clicked, I'd like the action to happen in another targeted window (with parameters passed on) and that my original window remains unchanged. That window may or may not already be open, the point is that a click on any button on my original page causes action in the other but always the same...
2
1475
by: Yama | last post by:
Hi, I have a button which is a server-side control. If a client-side error on a form is produced and a javascript (client-side) is fired how do I avoid the server-side button_client event to occur? (that is because the page gets refreshed for no reason even if I say do nothing) Thank you, Yama
1
1526
by: Jerry | last post by:
Hi, If I have a button control on a webform and double click to show the click event code, what code would go inside to open or redirect to an htm page? example Private sub mybutt_click( ..... Open or redirect to an htm page here... End sub
4
4031
by: Mark Lingen | last post by:
I've found a problem with postback event handling and webcontrol buttons. Try out the following code in an ASP.Net project and you will see. Create a web project in VB.Net and drop this code ontop of the webform1: Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code "
2
1567
by: ACaunter | last post by:
Hi there, I started a new website in asp.net.. made a page with some buttons and that on it.. copied it several times on different pages, so i get the save buttons in the same position on each page.. now i want to click on the buttons and open the different pages... Response.redirect("page.aspx") but it's not working... i've put labels and new buttons, and just wrote... label1.text = "hello" but that doesn't even work... what's going on...
3
10072
by: Sameer | last post by:
I have a webpage that has a link button. This link button on click opens up a new page. This is what is happening: 1. Load the web page. 2. Click on the link. 3. Refresh the web-page. Result: The webpage gets refreshed and the link buttons onClick event is fired.
1
1955
by: shapper | last post by:
Hello, I am creating a custom control where I have a button. Somehow my button click event is not being raised. I tried to place different codes inside MyButton_Click and nothing runs. Then I added Context.Response.Redirect("http://www.google.com"). When I click the button postback is done but the page google is not called.
6
16876
by: Mel | last post by:
I have a website that allows the user to generate a new quote. When they are finished creating the quote, it brings them to the final page (called the Goodbye.aspx page) which just states the quote has been submitted and an email will arrive to them shortly. I added a "Home" link button on this page which will return them to the website's home page. I want to clear out 10 session variables (contact name, ship to address, city, state,...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10112
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.