Monday, August 16, 2010

Can someone help me figure out how to pass unique ID of one gridview to another?

Hello there!


On my first page (called Home.aspx) I have a gridview that has a column that uses button for the user to click on and be directed to page 2 (called BookReviews.aspx). I do have it set up %26amp; working where the user clicks on a button in the gridview on Home.aspx and through a session variable it passes the bookID to display in a label on BookReviews.aspx. However, the problem is I would like ALL the bookReviews for that given bookID to be displayed in a gridview on BookReviews.aspx. I am not sure how I should go about doing this. Thanks for your help in advance!





**Book Table**


bookID


bookName





**Book Reviews**


bookID


bookReviewID


bookReviewDescription


bookReviewUserName





.......and this is what I have on my second page so far....





protected void Page_Load(object sender, EventArgs e)


{





if (!Page.IsPostBack)


}


labBookId.Text = Session[';bookID';].ToString();


labBookReviewDesc.Text = Sessoin[';bookReviewDescription';].ToStrin鈥?br>

{





}Can someone help me figure out how to pass unique ID of one gridview to another?
You can tell then button to send the id of ther record you have selected in the gridview. This can then be passed via querty string or session id to the next page by using a Response.Redirect





http://msdn2.microsoft.com/en-us/magazin鈥?/a>





That link should give you more info about using gridviews.





A more elegant way would be to use the details view grid on the same page.Can someone help me figure out how to pass unique ID of one gridview to another?
You can still hide the gridview and display the list in a repeater all on the same page. As in the other answer either use it in a querrystring in the url or pass it as a session variable.

No comments:

Post a Comment