top.aspx中有个按钮是 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="Button" />
当我在这个页面点击button1时
Button1.Attributes.Add("onClick", "window.showModalDialog(\"showModalDialog.aspx\",\"\",\"dialogWidth:400px;dialogHeight:400px\");");
showModalDialog。cs是:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;public partial class test : System.Web.UI.Page{ Hashtable ht; protected void Page_Load(object sender, EventArgs e){
if (!Page.IsPostBack){
ht = new Hashtable();
ViewState["ht"] = ht;
} }
protected void Button_Click(object sender, EventArgs e){
ht= (Hashtable)ViewState["ht"];
foreach (ListItem i in ListBox1.Items) {
if (i.Selected == true){
ListBox2.Items.Add(i.Text);
ht.Add(i.Text.ToString(), i.Value.ToString());
}
} int[] indexToDel = ListBox1.GetSelectedIndices(); //取得所有选取值的index集合
int cnt = indexToDel.Length;
for (int i = cnt - 1; i >= 0; i--) {
ListBox1.Items.RemoveAt(indexToDel[i]); }
}
protected void Button2_Click(object sender, EventArgs e){ ht = (Hashtable)ViewState["ht"];
int[] indexToDel = ListBox2.GetSelectedIndices(); //取得所有选取值的index集合
int cnt = indexToDel.Length;
foreach(ListItem i in ListBox2.Items){
if (i.Selected == true) {
ht.Remove(i.Text.ToString());}
} for (int i = cnt - 1; i >= 0; i--){
ListBox2.Items.RemoveAt(indexToDel[i]);
}
} protected void Button3_Click(object sender, EventArgs e){
ht = (Hashtable)ViewState["ht"];
Application["ht"] = ht;
Response.Redirect("right_top.aspx");
}}showModalDialog.aspx有个Button3_Click按钮当我点击一个按钮时,转发另个个页面,并且对话框关闭,怎么解决?
当我在这个页面点击button1时
Button1.Attributes.Add("onClick", "window.showModalDialog(\"showModalDialog.aspx\",\"\",\"dialogWidth:400px;dialogHeight:400px\");");
showModalDialog。cs是:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;public partial class test : System.Web.UI.Page{ Hashtable ht; protected void Page_Load(object sender, EventArgs e){
if (!Page.IsPostBack){
ht = new Hashtable();
ViewState["ht"] = ht;
} }
protected void Button_Click(object sender, EventArgs e){
ht= (Hashtable)ViewState["ht"];
foreach (ListItem i in ListBox1.Items) {
if (i.Selected == true){
ListBox2.Items.Add(i.Text);
ht.Add(i.Text.ToString(), i.Value.ToString());
}
} int[] indexToDel = ListBox1.GetSelectedIndices(); //取得所有选取值的index集合
int cnt = indexToDel.Length;
for (int i = cnt - 1; i >= 0; i--) {
ListBox1.Items.RemoveAt(indexToDel[i]); }
}
protected void Button2_Click(object sender, EventArgs e){ ht = (Hashtable)ViewState["ht"];
int[] indexToDel = ListBox2.GetSelectedIndices(); //取得所有选取值的index集合
int cnt = indexToDel.Length;
foreach(ListItem i in ListBox2.Items){
if (i.Selected == true) {
ht.Remove(i.Text.ToString());}
} for (int i = cnt - 1; i >= 0; i--){
ListBox2.Items.RemoveAt(indexToDel[i]);
}
} protected void Button3_Click(object sender, EventArgs e){
ht = (Hashtable)ViewState["ht"];
Application["ht"] = ht;
Response.Redirect("right_top.aspx");
}}showModalDialog.aspx有个Button3_Click按钮当我点击一个按钮时,转发另个个页面,并且对话框关闭,怎么解决?
{
//其它代码
Response.Write("<script language=javascript>window.open('right_top.aspx');window.opener=null;window.close();</script>"); }
{
Response.Write(" <script language=javascript>window.open('right_top.aspx');window.opener=null;window.close(); </script>");
}
protected void Button3_Click((object sender, EventArgs e)
{
Response.Write(" <script language=javascript>window.open('right_top.aspx');window.opener=null;window.close(); </script>");
}
{
Response.Write(" <script language=javascript>window.open('right_top.aspx');window.opener=null;window.close(); </script>");
}