473,503 Members | 2,159 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.EventArgs e)
{
Response.Redirect("inscricoes-explicadores-step01.aspx");
}
</script>
<html>
....

and

<asp:Button CssClass="button" ID="iniciar" runat="server" OnClick="goToPage"
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.EventArgs 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 40721
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="location.href='inscricoes-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******************@TK2MSFTNGP11.phx.gbl...
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.EventArgs e)
{
Response.Redirect("inscricoes-explicadores-step01.aspx");
}
</script>
<html>
...

and

<asp:Button CssClass="button" ID="iniciar" runat="server" OnClick="goToPage" 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.EventArgs 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*******@discussions.microsoft.com> wrote in message
news:#g**************@TK2MSFTNGP11.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="location.href='inscricoes-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******************@TK2MSFTNGP11.phx.gbl...
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.EventArgs e)
{
Response.Redirect("inscricoes-explicadores-step01.aspx");
}
</script>
<html>
...

and

<asp:Button CssClass="button" ID="iniciar" runat="server"

OnClick="goToPage"
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.EventArgs 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
4758
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...
1
1881
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...
2
1459
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...
1
1501
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(...
4
4009
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...
2
1555
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...
3
10006
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:...
1
1946
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...
6
16818
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...
0
7093
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...
1
7008
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...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
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,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
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 ...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
399
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...

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.