<script src="../../../Common/Scripts/Order/popup.js" type="text/javascript"></script> <script type="text/javascript"> function ShowHtmlString() { var strHtml = document.getElementById("details").innerHTML; var pop = new Popup({ contentType: 2, isReloadOnClose: false, width: 640, height: 300 }); pop.setContent("contentHtml", strHtml); pop.setContent("title", "html字符串示例"); pop.build(); pop.show(); } </script> <div id="details" style="display: none;font-size:medium;" runat="server"> </div>
后台代码:
string rOrderId = e.CommandArgument.ToString(); DataSet dsDetail= bf.GetDetailByRorderId(rOrderId); string html = "<table ><tr><td>冻结时间</td><td>失败信息</td></tr>"; if (dsDetail != null && dsDetail.Tables != null && dsDetail.Tables[0].Rows.Count>0) { for(int i=0;i<dsDetail.Tables[0].Rows.Count;i++) { DataRow dr=dsDetail.Tables[0].Rows[i]; html += "<tr ><td>" + dr["flCreateDate"] + "</td><td>" + dr["flLogInfo"] + "</td></tr>"; } } html += "</table>"; details.InnerHtml = html; Page.RegisterStartupScript("ww", "<script>ShowHtmlString();</script>");
首先要下载 popup.js,上面有很多例子。下载地址:http://pan.baidu.com/s/1f8qlu