Button control

J

Justnew

I have a button in my webform.aspx

And I have a htm document or page. What I want is that when I click on
the button I want to display the htm page. In other words it is just a
back button

Need help
thanks in advance


Justnew
 
M

Mark Jen [MSFT]

Hi Justnew,

If you are using ASP.NET, it sounds like you want to attach to the OnClick
event of the button. If you are using VS.NET, you can do this easily by
going go the design view, click on your button, go to the properties view
and select events. Then dobule click the blank to the right of the "Click"
action.

Alternatively, you can add this code in your code-behind...

In InitializeComponent():
this.<Button Variable Name>.Click += new
System.EvenHandler(this.<functionToBeFiredWhenButtonIsClicked>);

private void <functionToBeFiredWhenButtonIsClicked>(object sender,
System.EventArgs e)
{
// you can do anything you want in here, including navigate the user to
other places using Response.Redirect.
}

Also, if you just want a "Back" button, then you can use client-side HTML
and JScript to achieve the same thing. Here's a link on it:
http://www.cyfi.com/support/websupport/bonus/javascript_back_button.htm

HTH,
Mark Jen [MSFT]
 
J

Justnew

Let me explain more. This project is asp.net and I am using vb.net. No
the start page is welcome.htm and here I have a link to webform1.aspx
Now when I click on the link it takes me to the webform1.aspx An
inside this webform1.aspx I have this button (back, or home The aim i
to enable to navigate to the startpage. In windows application,
usually double click on the button and enter this code like:
dim frm as new form1
frm.show
in asp.net I can not do that I tried to
dim frm as new htmlform
frm ="welcome.htm"
I am geting this annoying blue line on the code.


*Hi Justnew,

If you are using ASP.NET, it sounds like you want to attach to th
OnClick
event of the button. If you are using VS.NET, you can do this easil
by
going go the design view, click on your button, go to the propertie
view
and select events. Then dobule click the blank to the right of th
"Click"
action.

Alternatively, you can add this code in your code-behind...

In InitializeComponent():
this.<Button Variable Name>.Click += new
System.EvenHandler(this.<functionToBeFiredWhenButtonIsClicked>);

private void <functionToBeFiredWhenButtonIsClicked>(object sender,
System.EventArgs e)
{
// you can do anything you want in here, including navigate the use
to
other places using Response.Redirect.
}

Also, if you just want a "Back" button, then you can use client-sid
HTML
and JScript to achieve the same thing. Here's a link on it:
http://tinyurl.com/2wnya

HTH,
Mark Jen [MSFT]
--
Please reply in newsgroup.
This posting is provided "AS IS" with no warranties, and confers n
rights.

Justnew said:
I have a button in my webform.aspx

And I have a htm document or page. What I want is that when I clic on
the button I want to display the htm page. In other words it i just a
back button

Need help
thanks in advance


Justnew

Justne
 
M

Martha[MSFT]

Call Response.Redirect from your Button_Click Sub. Here is an example:

private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect(http://localhost/Welcome.html);
}

You can redirect to any page (even those which don't belong to your program,
like yahoo.com)

Hope this helps,


Justnew said:
Let me explain more. This project is asp.net and I am using vb.net. Now
the start page is welcome.htm and here I have a link to webform1.aspx.
Now when I click on the link it takes me to the webform1.aspx And
inside this webform1.aspx I have this button (back, or home The aim is
to enable to navigate to the startpage. In windows application, I
usually double click on the button and enter this code like:
dim frm as new form1
frm.show
in asp.net I can not do that I tried to
dim frm as new htmlform
frm ="welcome.htm"
I am geting this annoying blue line on the code.


*Hi Justnew,

If you are using ASP.NET, it sounds like you want to attach to the
OnClick
event of the button. If you are using VS.NET, you can do this easily
by
going go the design view, click on your button, go to the properties
view
and select events. Then dobule click the blank to the right of the
"Click"
action.

Alternatively, you can add this code in your code-behind...

In InitializeComponent():
this.<Button Variable Name>.Click += new
System.EvenHandler(this.<functionToBeFiredWhenButtonIsClicked>);

private void <functionToBeFiredWhenButtonIsClicked>(object sender,
System.EventArgs e)
{
// you can do anything you want in here, including navigate the user
to
other places using Response.Redirect.
}

Also, if you just want a "Back" button, then you can use client-side
HTML
and JScript to achieve the same thing. Here's a link on it:
http://tinyurl.com/2wnya

HTH,
Mark Jen [MSFT]
--
Please reply in newsgroup.
This posting is provided "AS IS" with no warranties, and confers no
rights.

Justnew said:
I have a button in my webform.aspx

And I have a htm document or page. What I want is that when I click on
the button I want to display the htm page. In other words it is just a
back button

Need help
thanks in advance


Justnew
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message347224.html
*


Justnew
 
J

Justnew

Thank you Martha
It works thanks for the help
Martha said:
*Call Response.Redirect from your Button_Click Sub. Here is a
example:

private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect(http://localhost/Welcome.html);
}

You can redirect to any page (even those which don't belong to you
program,
like yahoo.com)

Hope this helps,


Justnew said:
Let me explain more. This project is asp.net and I am using vb.net Now
the start page is welcome.htm and here I have a link t webform1.aspx.
Now when I click on the link it takes me to the webform1.aspx And
inside this webform1.aspx I have this button (back, or home The ai is
to enable to navigate to the startpage. In windows application, I
usually double click on the button and enter this code like:
dim frm as new form1
frm.show
in asp.net I can not do that I tried to
dim frm as new htmlform
frm ="welcome.htm"
I am geting this annoying blue line on the code.



Mark Jen [MSFT] wrote:


Justnew

Justne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top