User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 429,789 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,826 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 69168 | Replies: 11
Reply
Join Date: Nov 2003
Posts: 1
Reputation: steven is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
steven steven is offline Offline
Newbie Poster

Button to open a new browser window

  #1  
Nov 6th, 2003
Hello ,
I am using web matrix and c#.
I want to open a new browser from a button click.
How can I do that?
Thanks in advance.
Steve
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 25
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: asp.net inquiry

  #2  
Nov 8th, 2003
One way is with a JScript function in the OnClick event for a button.
<form id="Form1">
<INPUT Type="button" OnClick="window.open('http://www.google.ca')" value="enter">
</form>

That help?
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Apr 2008
Posts: 4
Reputation: humhaingaurav is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
humhaingaurav humhaingaurav is offline Offline
Newbie Poster

Re: asp.net inquiry

  #3  
May 6th, 2008
Originally Posted by Paladine View Post
One way is with a JScript function in the OnClick event for a button.
<form id="Form1">
<INPUT Type="button" OnClick="window.open('http://www.google.ca')" value="enter">
</form>

That help?

Thanks a lot for your help man ... You posted solution in 2003 about opening new window through ASP .net button ... I was so frustrated because of that button problem but your solution helped me .. thanks a lot
Reply With Quote  
Join Date: Jun 2004
Posts: 32
Reputation: jackster is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
jackster jackster is offline Offline
Light Poster

Re: Button to open a new browser window

  #4  
Jun 18th, 2004
sadly you have missed the point of asp.net

you are using traditional html tags which renders asp.net useless.

read up on server controls.

<form runat=server>
<asp:button id=button1 runat=server>
</form>


--
in the page load add:
button1 .Attributes.Add("onclick", "whatEverYouWantTheJavaSciptToDo");


i think this is right

if you wanna learn .net

buy ASP.NET for Beginners using c# from WROX

jack
www.ansariltd.com
Reply With Quote  
Join Date: Feb 2002
Location: New York
Posts: 862
Reputation: Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light 
Rep Power: 12
Solved Threads: 15
Moderator
Tekmaven's Avatar
Tekmaven Tekmaven is offline Offline
The C# Man, Myth, Legend

Re: Button to open a new browser window

  #5  
Jun 18th, 2004
Originally Posted by jackster
you are using traditional html tags which renders asp.net useless.

read up on server controls.

I would consider myself a professional ASP.NET Web Developer, and I use HTML over ASP.NET Controls wherever I can. This is taught; the less controls, the less server overhead. Instead of performing countless things to output a simple link, I rather use the anchor tag. If I have a button on my page which does nothing server side, why add the extra overhead of a server control? It's pointless.

Furthermore, you can control most standard html controls with ASP.NET, just give them an ID="" and runat="server" in their tag.
-Ryan Hoffman

ASP.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 25
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Solution Re: Button to open a new browser window

  #6  
Jun 21st, 2004
Originally Posted by jackster
sadly you have missed the point of asp.net

you are using traditional html tags which renders asp.net useless.

read up on server controls.

<form runat=server>
<asp:button id=button1 runat=server>
</form>


--
in the page load add:
button1 .Attributes.Add("onclick", "whatEverYouWantTheJavaSciptToDo");


i think this is right

if you wanna learn .net

buy ASP.NET for Beginners using c# from WROX

jack
www.ansariltd.com


Actually I didn't think I missed the point. The question was simple and answered. No requirements were stated. And besides that

OnClick could have contained ="Load_NewPage()" which points to a Load_NewPage() function (or method) in the C# code behind. I just gave the suggestion as a general means of doing it.

But then again, he can use whatever method he wants!

Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Jun 2004
Posts: 32
Reputation: jackster is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
jackster jackster is offline Offline
Light Poster

Re: Button to open a new browser window

  #7  
Jun 22nd, 2004
point taken
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 25
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Button to open a new browser window

  #8  
Jun 22nd, 2004
Thanks ... haha.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Feb 2002
Location: New York
Posts: 862
Reputation: Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light Tekmaven is a glorious beacon of light 
Rep Power: 12
Solved Threads: 15
Moderator
Tekmaven's Avatar
Tekmaven Tekmaven is offline Offline
The C# Man, Myth, Legend

Re: Button to open a new browser window

  #9  
Jun 24th, 2004
Well, a new article on MSDN came out yesturday, titled Improving ASP.NET Performance, and I'll quote it:

---
Use Server Controls Where Appropriate



The HTTP protocol is stateless; however, server controls provide a rich programming model that manages state between page requests by using view state. Server controls require a fixed amount of processing to establish the control and all of its child controls. This makes server controls relatively expensive compared to HTML controls or possibly static text. Scenarios where server controls are expensive include the following:
  • Large payload over low bandwidth. The more controls that you have on a page, the higher the network payload is. Therefore, multiple controls decreases the time to last byte (TTLB) and the time to first byte (TTFB) for the response that is sent to the client. When the bandwidth between client and server is limited, as is the case when a client uses a low-speed dial-up connection, pages that carry a large view state payload can significantly affect performance.
  • View state overhead. View state is serialized and deserialized on the server. The CPU effort is proportional to the view state size. In addition to server controls that use view state, it is easy to programmatically add any object that can be serialized to the view state property. However, adding objects to the view state adds to the overhead. Other techniques such as storing, computed data or storing several copies of common data adds unnecessary overhead.
  • Composite controls or large number of controls. Pages that have composite controls such as DataGrid may increase the footprint of the view state. Pages that have a large number of server controls also may increase the footprint of the view state. Where possible, consider the alternatives that are presented later in this section.

When you do not need rich interaction, replace server controls with an inline representation of the user interface that you want to present. You might be able to replace a server control under the following conditions:
  • You do not need to retain state across postbacks.
  • The data that appears in the control is static. For example, a label is static data.
  • You do not need programmatic access to the control on the server-side.
  • The control is displaying read-only data.
  • The control is not needed during postback processing.
Alternatives to server controls include simple rendering, HTML elements, inline Response.Write calls, and raw inline angle brackets (<% %>). It is essential to balance your tradeoffs. Avoid over optimization if the overhead is acceptable and if your application is within the limits of its performance objectives.

---

Now, if this doesn't illustrate what I've said, I'm not sure if anything could ;-).
-Ryan Hoffman

ASP.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
Reply With Quote  
Join Date: Jun 2007
Posts: 1
Reputation: tidustr is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tidustr tidustr is offline Offline
Newbie Poster

Re: Button to open a new browser window

  #10  
Jun 23rd, 2007
dfdf
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 4:18 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC