Pass grid values as query strings when click on hyperlink COlumn in the grid - ASP.Net , ASPXGridView , Java Script


This show how to pass wuery strings to a another page by using javascript in Asp.Net.
Also this pass the ASPXGridView data column cell values as the query string values...

Imagine you have a custom button( Ex:- link button) on the aspx web page. Then go to
CustomButtonClick event in the client side...below is the code

-------------------------
<ClientSideEvents CustomButtonClick="function(s, e) {
    if (e.buttonID == 'Rental')
{
        s.GetRowValues(e.visibleIndex, 'COLUMN_NAME1;COLUMN_NAME2', function(v){ window.open('NEXT_PAGE.aspx?QUERY_STRING1='+v[0]+'&amp;QUERY_STRING2='+v[1], 'popup','width=900,height=700,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=50,top=0'); });
}
}" />

-------------------------
This act as a pop to a another page named "NEXT_PAGE.aspx" Also Query strings are QUERY_STRING1 & QUERY_STRING2. And the Aspxgridview column names are
COLUMN_NAME1 & COLUMN_NAME2.

So you can handle your code in the NEXT_PAGE.aspx with the query string values.

Comments

Popular Posts