Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 Open Popup window from Gridview Select column in
Posted by Poornima on  10/14/2009 2:05:34 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
int i = GridView1.SelectedRow.RowIndex;
string number = GridView1.SelectedRow.Cells[3].Text;
Session["filenumber"] = number;


so when i click on select column in gridview ,it will take that number and go to another page 'history.aspx' ,there it will display the file in gridview with that particular number.
but now i want it to happen in another pop up window.

Post Your Reply Post New Question

 Viewer's Reply
Opening New Window And Redirect to Next Page from GridView Select Command
Answered By Moderator1 on 10/14/2009 9:49:16 PM

Follow the code below,

In the GridView RowCommand Event, write the below code,

string number = GridView1.SelectedRow.Cells[3].Text;
Session["filenumber"] = number;

string strScript = "<script> ";
strScript += "var newWindow ='History.aspx', '_blank','height=450, center:yes, width=600, status=no, resizable= yes, menubar=no, toolbar=no, location=yes, scrollbars=no, status=no');";
strScript += "window.location='History.aspx';";
strScript += "</script>";
Page.RegisterClientScriptBlock("strScript", strScript);

Instead of Session, you can also pass filenumber as query string.
Hope this code will help you and I will put this code in Tips & Tricks section.

create pop up window in datagrid
Answered By Irfan on 10/10/2011 12:26:47 AM
hai I want to display a pop up window when i click any of the rows in a datagrid and the id of particular grid should be displayed

plz reply me soon
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Take Advantage of Oracle's 2 Day DBA Course
Oracle Magazine