日期:2014-05-17 浏览次数:20436 次
<iframe id="Reply" width="100%" runat="server" scrolling="yes" src="<%=GetSrc() %>" ></iframe>
protected void ShowReply(object sender, EventArgs e) { //Panel1.Attributes.Add("style", "display:none"); string url = "ShowEmailDetails.aspx?ID=" +_id ; Reply.Attributes.Add("src", url); }
<iframe id="Reply" width="100%" runat="server" scrolling="yes" ></iframe> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
------解决方案--------------------
照你的写的代码,你可以拷贝测试,你看看每次的url变了吗?
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> private String _id = ""; protected void ShowReply(object sender, EventArgs e) { _id = Guid.NewGuid().ToString(); string url = "ShowEmailDetails.aspx?ID=" + _id; Reply.Attributes.Add("src", url); } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Reply.Attributes.Add("src", "ShowEmailDetails.aspx"); } } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> </head> <body> <form runat="server" id="form1"> <iframe id="Reply" width="100%" runat="server" scrolling="yes"></iframe> <asp:Button ID="Button1" runat="server" onclick="ShowReply" Text="改变" /> </form> </body> </html>
------解决方案--------------------
本来javascript可以轻松解决的问题,非要回发到后台,由asp.net来折腾
------解决方案--------------------
window.mainFrm.location = urlStr; //兼容IE FF