在我的网站上我正在使用colorbox执行popup div(在母版页中)。我需要的是我只想弹出这个颜色框一次,然后只在登录后弹出。
Hi , In my site am doing popup div with colorbox (in master page). its working fine. but i want to pop up this colorbox div after successfull login. this is also done. but my req is i want to popup this color box only once and that to after login only. so could u give any suggestion to find the page is loading firsttime or second time. not using (!ispostback concept in page load)
$(document).ready(function () {
var hfClose = $('#hfCloseColorbox').val();
var page = $(location).attr('pathname'); // index.php
if (page == '/Default.aspx') {
if (hfClose == '2') {
$.colorbox({ width: "32%", inline: true, href: "#DisplayChat" });
}
}
});
if (!IsPostBack)
{
if (hfCloseColorbox.Value == "")
hfCloseColorbox.Value = "2";
else if (ViewState["count"] == null)
hfCloseColorbox.Value = Convert.ToString(int.Parse(hfCloseColorbox.Value) + 1);
else if (ViewState["count"].ToString() == "1")
hfCloseColorbox.Value = Convert.ToString(int.Parse(ViewState["count"].ToString()) + 1);
hfCloseColorbox.Value = Convert.ToString(int.Parse(hfCloseColorbox.Value) + 1);
}
else
{
if (ViewState["count"] == null)
hfCloseColorbox.Value = Convert.ToString(int.Parse(hfCloseColorbox.Value) + 1);
else if (ViewState["count"].ToString() == "1")
hfCloseColorbox.Value = Convert.ToString(int.Parse(ViewState["count"].ToString()) + 1);
}
答案 0 :(得分:0)
您可以在ViewState中创建自己的特殊变量,以确定是否第一次加载页面(登录后)。
if (ViewState["Foo"] != null && ViewState["Foo"] == "True")
{
// Code for Pop-Up display
}
只有为ViewState [“Foo”]赋值的地方才是成功登录后的代码。