I have all the code I need to response.redirect
a page and pass the information I need to the other page. But I don't want it to redirect the page but rather create a popup in the page.
I have code for the popup also but I can't manage to pass information to it.
This is the code for the popup and it's not passing any information:
<asp:LinkButton ID="lb_viewstudenttimetable" runat="server" OnClick="lb_viewstudenttimetable_Click"
OnClientClick="window.open('Timetable_User.aspx','Timetable','width=640,height=360,scrollbars=yes');">
This is the code for the OnClick
button where it passing information to the other page
protected void lb_viewstudenttimetable_Click(object sender, EventArgs e)
{
GridViewRow row = gv_classlist.SelectedRow;
Response.Redirect("Timetable_User.aspx?UserID=" + row.Cells[1].Text + "");
//my attempt of trying to pass the following to the popup
//Response.Write("window.open('Timetable_User.aspx?UserID="+row.Cells[1].Text+"','Timetable','width=640,height=360,scrollbars=yes');");
}
So I wanna use OnClientClick
to do what that OnClick
does.
Do you want a pop-up or a new browser tab? If you want a pop up, I generally use iframe like this.
Just pass the query string:
The question is then how to get "x" into the query string when "x" comes from the server. What you need to do is, in the Databinding event of the GridView, build the JavaScript string to be used OnClientClick, then set it. That way, the LinkButton in each grid row will already be prepared for when it is clicked.