Monday, March 26, 2012

Passing values from one page to another

I have a Page1.htm with the following code:

<HTML>
<frameset cols="40%,*" >
<frame name="LeftFrame" src='Page2.aspx?Table=??' >
<frame name="RightFrame" >
</frameset>
</HTML
Page1.htm was called using Page1.htm?Table=Users.

I don't know the syntax of how to pass the value of the parameter "Table" onto the second page I'm loading on the LeftFrame, using request.querystring( "Table" ).

I apprecciate any help.

Mosheuse the following:

<frame name="LeftFrame" src='Page2.aspx?Table=<% Response.Write(Request.QueryString("Table"));%>'
Moshe & Sachin

Thanks for your contribution Sachin but the suggestion will not work as it basically an static HTM page as Moshe wrote "I have a Page1.htm with ..." Therfore Response.Write(Request.QueryString("Table")) can't be performed there! An static page would not be able to process this directive. However, the frame file Page2.aspx is able to process all server side code like a normal ASP.NET page.

If you go like src='Page2.aspx?Table=myTable', this will do as its an static parameter. However you can always parse this using java script (it works in static HTML). Try this article
http://www.eggheadcafe.com/articles/20020107.asp

OR make page1.htm (main page) a webform (aspx file) i.e. page1.aspx and this will do as well.

Hope it helps.

-Adnan Masood
Sachin & Adnan,

Thanks very much for the information.

For now I'm implementing the solution keeping Page1.htm as it is and not as a web form, I went to the article Adnan recommended and I already have a function called "queryString()" that is working and returning the value for the parameter "Table" correctly.

Please tell me how to insert the value returned by the javascript function "queryString()" in the code:

<frame name="LeftFrame" src='Page2.aspx?Table=??'
Thanks,
Moshe

0 comments:

Post a Comment