Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What I exactly want is,
when I click on gridview ,that entire row data should be passed on this newly opened webform.This webform shall contain required fields.
for example
Webform contain
textboxes for say, Sno ,Sname
and my grid contain say 5 records on Sno,Sname when I click on first row ,that row details shall be moved on this textboxes and this page shall be opened as a new window.
cross page posting I need to perform but on click of gridview row.

Please help. I shall be grateful to you all.

What I have tried:

I have tried the above said, but all I am able to do is to pass the data to a new webform on selectIndexchanging event
I am not able to open a new popup window.

protected void gdvUserList_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{

SqlConnection scon = new SqlConnection();

SqlDataAdapter sda = new SqlDataAdapter("select * from LoginD", scon);
DataSet ds = new DataSet();
sda.Fill(ds, "LG");
string url;
url = "NewUser.aspx?id=" + gdvUserList.Rows[e.NewSelectedIndex].Cells[1].Text +
"&Name=" + gdvUserList.Rows[e.NewSelectedIndex].Cells[2].Text +
"&LName=" + gdvUserList.Rows[e.NewSelectedIndex].Cells[3].Text +
"&Dept=" + gdvUserList.Rows[e.NewSelectedIndex].Cells[4].Text +
"&Ugroup=" + gdvUserList.Rows[e.NewSelectedIndex].Cells[5].Text +
"&Desig=" + gdvUserList.Rows[e.NewSelectedIndex].Cells[6].Text
+ "&Report=" + gdvUserList.Rows[e.NewSelectedIndex].Cells[7].Text +
"&Username=" + ds.Tables["LG"].Rows[0][3].ToString() +
"&Password=" + ds.Tables["LG"].Rows[0][4].ToString() +
"&Email=" + ds.Tables["LG"].Rows[0][6].ToString() +
"&Mobile=" + ds.Tables["LG"].Rows[0][8].ToString() +
"&Branch=" + ds.Tables["LG"].Rows[0][10].ToString() +
"&Org=" + ds.Tables["LG"].Rows[0][9].ToString() +
"&Category=" + ds.Tables["LG"].Rows[0][12].ToString();

Response.Redirect(url);
Posted
Updated 25-Aug-16 22:14pm
v2

Rather than the Redirect use RegisterStartupScript[^] to generate script that uses "window.open" to open the url you are defining in your code.

Window open() Method[^]
 
Share this answer
 
use below code
C#
string url = "/WebForm1.aspx?op=Sum&&a=100&&b=200";
            //Response.Redirect(url,false);
            Response.Write("<script>window.open('"+url+ "', '_blank');</script>");
 
Share this answer
 
Comments
RS07 26-Aug-16 4:34am    
Thank you for the response.
But I want to open this new window on and above my previous window.
That means both window should be visible,the new window should look like child window.
RS07 26-Aug-16 5:16am    
Thanks for both the solution.
I added height and width attribute to your snippet and got what I was looking for.
Thankyou once again.
Anisuzzaman Sumon 29-Aug-16 0:52am    
mention not :)

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