Click here to Skip to main content
15,885,885 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to pass values in grid view to another page with query string

by clicking on hyperlink of a column the entire row values need to pass to another page
Posted
Comments
Rohith Gopi 5-Nov-12 6:20am    
How many columns are there? is it ok if we are passing those values on a single button click or single hyper link click? is there any button field??
venky1988 5-Nov-12 6:44am    
there are totally 11 columns having 1 column hyperlink . if i click on hyperlink the entire row values need to pass to 2nd page
[no name] 5-Nov-12 6:21am    
either pull row data using datakeys or command argument and assign to query string of ur url, or just send the primary key and make a call to db to get that row and use it....
venky1988 5-Nov-12 7:05am    
ok shabari ,
i will send the primary key and make a call to db to get the row details

thank you very much
venky1988 5-Nov-12 7:10am    
can u plz suggest me how to send of text box inside grid view to another page using query string

On a button onClientClick function give the following code..

HTML
OnClientClick='<%# String.Format("jSFunctionName(""{0}"");",DataBinder.Eval(Container.DataItem,"ColumnName")) %>'


Is it OK???
 
Share this answer
 
v2
Comments
venky1988 5-Nov-12 6:41am    
actually i want to pass some of row values of selected column
like if i select userid then username , usersalary need to pass )
to another page can u suggest me by using query string thanks in advance
Rohith Gopi 6-Nov-12 5:50am    
Using the answer that i have given you can get a unique key inside javascript. Use unique key as a query string and using the unique key fetch the values in the other page. passing all the 11 column values to the other page is possible but it makes your code ugly..
try this..

On RowDataBound event add attributes to the hyperlink..

for Ex:

1. Dim HYPERLINK As LinkButton = DirectCast(e.Row.FindControl("lnkButReport"), LinkButton)


2. HYPERLINK.Attributes.Add("onclick", "window.open('../AnotherPage.aspx?Querystrin1=" & Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ColumnName1"))& "&Querystrin1="& Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ColumnName2"))&"','CustomPopUp','width=900, height=650,left=50,top=20,resizable=1,scrollbars=1','info');return false;")


i have shown only two columns in the query string, you can add as many as you can...


hope this will help you...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900