巨难:showModelWindow中的怪问题,求救高手。
private void Save_Click(object sender, System.EventArgs e)
{ SqlConnection conn=new SqlConnection(connstr);
try
{
conn.Open();
string commstr="update iteminfo set model_no='"+model_no.Text+"',pkclass='"+pkclass.Text+"',freq='"+freq.Text+"',";
commstr=commstr+"func='"+func.Text+"' where id="+int.Parse(id)+"";
SqlCommand comm=new SqlCommand(commstr,conn);
comm.ExecuteNonQuery();
Response.Write("<script>alert('保存成功!');</script>");
}
catch(SqlException ex){Response.Write("<script>alert('保存失败,错误原因:"+ex.Message+"');</script>");}
finally{conn.Close();}
}
一、为什么我保存成功的时候,出现了两个一模一样的模态窗口。保存成功提示出现在第二个,不是在我的那个窗口中弹出来的?如何解决?
二、在该模态窗口中我一定要用private static string id;如果不加static在保存的时候id(它来自于父窗口传递的参数)值为空。但是在窗体第一次加载的时候是有值的。什么原因,刚转向C#就有这样的问题??
三、按思归办法:说在模态窗口中点一按钮可执行父窗口中某按钮的事件。
可是我试了都不行,不按是服务器按钮或html按钮。
in父窗口:
var ret = showModalDialog("new.aspx",window);
in 模态窗口 (note, it is a client side button)
<input type=button value="click" onclick="window.dialogArguments.document.getElementById('Button2').click()">
其实我的目录就是在模态窗口中更改后,在父窗口刷新而己。最后40分了,我知道100就值得,谢谢大家了。