Web Analytics Made Easy -
StatCounter opening one aspx page in another and passing values - CodingForum

Announcement

Collapse
No announcement yet.

opening one aspx page in another and passing values

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • opening one aspx page in another and passing values

    in asp.net i have a grid on a page"(page1.aspx) which is populated with data from database
    when i clcik on a particular row , i get the id of the row.i want to open another page(page2.aspx) by using the id from page1.aspx on a button click.
    i cant use respons.redirect as the original "(page1.aspx)wuld get closed and page2.aspx wuld be dispalyed
    i have used iframe and i am able to view page2.aspx on a button clcik in page1.aspx

    but how do i pass the value(id) so that i culd get that particular row details

    or is there any other way

  • #2
    Use a detailsview to show all the relevant information about a particular row. For example, you could include a "view details" link on the gridview, then have the click event for that link open up your detailsview.
    Music Around The World - Collecting tips, trade and want lists, album reviews, & more

    Comment


    • #3
      QueryString

      I would append a querystring onto the end of your page2.aspx call. I am not sure how you are "calling" page2.aspx to come up in the iframe, but when you do, instead of saying go to page2.aspx, instead use this:

      "page2.aspx?id=" & rowID

      where rowID would be a parameter holding the rowID of the gridview row.

      Then on your page2.aspx code behind, in either a Page_Load (or Page Load Complete) method (or any other method that you want), do something like the following to get the id:

      Dim rowID = Request.QueryString("id").ToString

      Even though you are opening the page in the same window, the url should propagate through to the page itself.


      Another method I use instead of using frames is to create 2 panels and put all of your "page1" controls in one, and all of the "page2" controls in the other. Then when it is time to "switch pages", instead of calling another page in another frame, just hide the 1st panel and display the 2nd (you can set the 2nd to Visible=False by default so it doesn't display). This way you are still on the same page and should still have access to the rowID.
      Last edited by Punkcrib; Apr 16, 2009, 12:04 PM.

      Comment

      Working...
      X