Often a times we come across a situation where we require one page data on another page and need to perform some database related tasks.
The solution most of us adopt is we add those values either in a temporary table or some collection say Hashtable or Arraylist.I have one interesting solution to cope up with this scenario.
Yes, I am talking about Cross Page Posting. Cross page posting allow us to post one page information to another page, we need to add
in the page on which we need to fetch information.
Here is a sample code demonstrating cross page posting.
Yesterday I came across a problem wherein I was unable to get the GridViewRow on RowCommand Event when ImageButton was clicked. Googling around I came across a solution which is quite simple.
Here is the Template field in GridView
<asp:ImageButton id=”image” runat=”server”>
//Code in GridView RowCommand Event.
ImageButton button = ((ImageButton)(e.CommandSource))
GridViewRow row = button.Parent.Parent[/code]
Here button.Parent will give you GridViewCell, and calling GridViewCell.Parent will give you GridViewRow.