如何在ASP.Net中创建一个弹出窗口,并使用查询字符串将信息传递给它? [英] How to make a popup in ASP.Net and pass information to it using a query string?
本文介绍了如何在ASP.Net中创建一个弹出窗口,并使用查询字符串将信息传递给它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我拥有了response.redirect
页面所需的所有代码,并将我需要的信息传递给另一页面.但是我不希望它重定向页面,而是在页面中创建一个弹出窗口.
我也有用于弹出窗口的代码,但是我无法设法将信息传递给它.
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');">
这是OnClick
按钮的代码,它将信息传递到其他页面
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');");
}
所以我想用OnClientClick
做OnClick
要做的事情.
So I wanna use OnClientClick
to do what that OnClick
does.
推荐答案
GridViewRow row = gv_classlist.SelectedRow;
lbl_timetableuserid.Text = row.Cells[1].Text;
ScriptManager.RegisterStartupScript(this, typeof(string), "New_Window", "window.open('Timetable_User.aspx?UserID=" + row.Cells[1].Text + "', null, 'height=360,width=640,status=yes,toolbar=yes,menubar=yes,location=no' );", true);
这篇关于如何在ASP.Net中创建一个弹出窗口,并使用查询字符串将信息传递给它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文