.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

how to open new webpage using c#.net

Posted By: Vikramraj     Posted Date: March 18, 2011    Points:5   Category :C#
i have one web page in asp.net done in c# want to open new webpage onclick event of button keeping existing web page open

Responses
Author: kamlesh             
Posted Date: March 18, 2011     Points: 20   

Add the following code in ur Page_Load()
Code:
string strSearchText = txtSearch.Text.Trim(); //text from your TextBox
if(strSearchText!="")
btnSearch.Attributes.Add("OnClick","javascript:OpenSearchResults('"+strSearchText+"');");


In ur HTML add the following script
Code:

<script language="javascript" type="text/javascript">
function OpenSearchResults(str)
{
var url = "http://www.google.com/search?q="
window.open(url+str);
}
</script>

Thanks And Regards.
Kamlesh Nikam
Author: chandrakant             
Posted Date: March 19, 2011     Points: 20   

use Server.Transfer Method

* we want to transfer current page request to another .aspx page on the same server
* we want to preserve server resources and avoid the unnecessary roundtrips to the server
* we want to preserve Query String and Form Variables (optionally)
* we don't need to show the real URL where we redirected the request in the users Web Browser
Chandrakant

Author: Maverick             
Posted Date: March 21, 2011     Points: 20   

Hello,

You can user server.transfer or javascript of window.open()

if you use javascript then add
btnOpen.attributes.add("onclick","openenew()") on the page load

Thanks,
Maverick

Thanks,
Maverick


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend