繁体   English   中英

使用Ajax Modal Popup扩展器时无法获取Cookie值

[英]Unable to fetch Cookie values while using Ajax Modal Popup extender

这是场景:我有一个带有按钮的页面( Homepage.aspx )。 当我单击时,我习惯在.CS文件中按钮的_Click方法内的cookie中传递一些值,然后打开另一个aspx页面( Detail_Report.aspx ),在该页面中,我从cookie中检索值,然后显示该页面的内容。使用我检索到的值。

现在,最近我决定实现Ajax弹出扩展器以显示Detail_Report.aspx页面。

我可以使用以下代码执行此操作:

    <asp:modalpopupextender id="ModalPopupExtender1" 
            runat="server" cancelcontrolid="btnCancel" 
            okcontrolid="btnOkay" targetcontrolid="Detail_Report" 
            popupcontrolid="DR" popupdraghandlecontrolid="PopupHeader" 
            drag="true" backgroundcssclass="ModalPopupBG">
        </asp:modalpopupextender>

      <div class="popupConfirmation" id="DR" style="display: none">
    <iframe id="frameeditexpanse" src="DetailReport.aspx" frameborder="1">
    </iframe>
    <div class="popup_Buttons" style="display: none">
        <input id="btnOkay" type="button" value="Done2" />
        <input id="btnCancel" type="button" value="Cancel2" />
    </div>
</div>

这是按钮声明:

<asp:Button ID="Detail_Report" runat="server" 
                style="z-index: 1; left: 60px; top: 110px; position: absolute; width: 230px;" 
                Text="Detail Report" Font-Bold="True" BorderStyle="Solid" 
                Enabled="False" onclick="Detail_Report_Click"/>

这就是我的onClick方法中的内容:

protected void Detail_Report_Click(object sender, EventArgs e)
        {
            //string javaScript = "<script language=JavaScript>\n" + "DetailReport();\n" + "</script>";
            Response.Cookies["proj"].Value = c_ProjName.Text.ToString();
            Response.Cookies["LOB"].Value = c_LOB.Text.ToString();
            Response.Cookies["release"].Value = c_ReleaseName1.Text.ToString();
            Response.Cookies["country"].Value = c_CountryName.Text.ToString();
            Response.Cookies["testenvkey"].Value = testenvkey.ToString();
            //ClientScript.RegisterStartupScript(this.GetType(), "Detail_Report_Click", javaScript);

现在我的问题是弹出窗口来了,但是我无法从cookie中获取值,因为它们是空白的。 结果,我的Detail_Report.aspx页面无法正确显示

%If Session("ChildLoad") = "True" Then%>
 'Model Extender and panel
  <%end if%>

然后在子页面的加载中检查会话状态(如果为true),然后从会话或cookie中选择值,但为此您需要启用回发到主页上。

背后的想法是

当您刷新主页时,也会触发子页面的加载事件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM