//首先判断缓存是否已存在
      if (DataCache.GetCacheItem(keyHtml) != null && DataCache.GetCacheItem(keyLink) != null)
        {
            string html = (string)Supcon.XMES.Cache.DataCache.GetCacheItem(keyHtml);
            string exportLink = (string)Supcon.XMES.Cache.DataCache.GetCacheItem(keyLink);
            StringBuilder sb = new StringBuilder();
            sb.Append("{'State':'OK','Html':'").Append(html).Append("','exportLink':'").Append(exportLink).Append("'}");
            Response.Write(sb.ToString());
            return;
        }
 //如果需要重新生成报表,下面的代码重新生成报表
        try
        {
          //执行大部分操作。
        }现在我想利用javascript confirm做这样的事情。
首先判断缓存中是否已经存在数据,如果已经存在的话。提示用户已存在是否重新生成。如果点取消就执行if花括号里的代码: if (DataCache.GetCacheItem(keyHtml) != null && DataCache.GetCacheItem(keyLink) != null)
        {
            string html = (string)Supcon.XMES.Cache.DataCache.GetCacheItem(keyHtml);
            string exportLink = (string)Supcon.XMES.Cache.DataCache.GetCacheItem(keyLink);
            StringBuilder sb = new StringBuilder();
            sb.Append("{'State':'OK','Html':'").Append(html).Append("','exportLink':'").Append(exportLink).Append("'}");
            Response.Write(sb.ToString());
            return;
        }
如果点确定的话就执行try中的代码。现在不知道这个confirm如何写好啊。在.net后台需要判断用户点击的是确认还是取消。

解决方案 »

  1.   

    把confirm返回的变量存入hidden中
      

  2.   

    09年的一个帖子
    http://topic.csdn.net/u/20090819/17/0F291A9E-05D1-46BC-BFAE-54188DB182A0.html
      

  3.   

    http://topic.csdn.net/u/20090910/09/014AF035-3A05-42A3-91B2-51DD346B3F0E.html
      

  4.   

    非哥。你方法真不错。
    再定义两个button的事件
      

  5.   

    HTML code<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <asp:Button ID="btnCall……
    [/Quote]
      

  6.   

    刚写了个新的解决办法,一会写在BLOG 上。
      

  7.   

    好,现在我发现有些不适合我。
    我刚正在想解决方案。。
    因为你是通过触发button的事件执行的
    我要是想在别的地方执行btnYes的话还得去触发button的click,
    在.net后台都不知道怎样去触发button的click
      

  8.   

    http://blog.csdn.net/Sandy945/archive/2010/07/06/5715583.aspx
      

  9.   

    非哥,现在完全理解了你上面 给的那个链接意思
    发现我现在的项目要是弄成这种ajax方式实现的话也添加了不少麻烦。
    虽然说你楼上另外两种方法也不是很简洁,但是相比 之下还是会少些,
    所以放弃ajax.
    多谢非哥。