Thursday, March 22, 2012

Open a new page and pass parameters to this page

for the onclick event of a button, it can open a new web page (this page has been created in my project) and pass some parameters to this page. Does any one know the codes to implement this? Thanks!

you can do http post or http get to pass data into another page

to open new web page use javascript

Use this javascript function
<script language="JavaScript"
<!--//

function new_window(url) {

link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=500,left=40,top=50");

}
//-->
</script>
then you can either use a button to open it

btnOpen.Attributes.Add ("onClick", "new_window('test.aspx')")

or hyperlink

<asp:HyperLink id="lnkOpen" runat="server">Open</asp:HyperLink
lnkOpen.Attributes.Add("onClick", "new_window('test.aspx')")

or Response.Write

Response.Write("<script language = ""Javascript"">var win=window.open('limitAlert.aspx',null,'width=510,height=255,top=250,left=250','true');</script>")


dear

use javascript

window.open('WebForm2.aspx?id=11');

and in your webform 2 use Request.QueryString['id'] --> this will return 11

Happy Coding


thanks for both of you. I will try suggestion you gave me. thank you very much.

Dear,

Mark this post as Resolved to give the credibility to the users that helped you if this post was answered correctly

Happy Coding

0 comments:

Post a Comment