在主界面中(webform1.aspx)弹出模式页面(webform2.aspx)并向(webform2.aspx)的textbox控件赋值。
(1)、在webform1.aspx的button中写
Page.RegisterStartupScript("","<script>var a=new Array(document.all.TextBox1,document.all.TextBox2); window.showModalDialog('WebForm2.aspx',a,'');</script>");
(2)、在webform2.aspx的page_load中写
Page.RegisterStartupScript("","<script>var a=window.dialogArguments;document.all.TextBox1.value=a[0].value;document.all.TextBox2.value=a[1].value;</script>");
文章讲述了如何在ASP.NET中,通过JavaScript和RegisterStartupScript方法,从webform1.aspx的按钮触发一个弹出的webform2.aspx页面,并实现在两个页面之间的控件值传递。
1855

被折叠的 条评论
为什么被折叠?



