我正在显示一个具有显示更多详细信息的选项的Gridview。选择此选项后,将打开第二个GridView。
有一个隐藏字段,它在页面首次运行时设置为false。
<asp:HiddenField ID="hfDetailsShown" runat="server" Value="false" />
当用户单击显示更多详细信息按钮时,我将hiddenfield设置为true
function ShowAll()
{
$(".ShowHide").each(function () {
if ($(this).html() == "Show") {
document.getElementById('<%= hfDetailsShown.ClientID %>').value = true;
$(this).html("Hide");
$(this).closest("tr").after("<tr><td colspan = '999' style='padding:0px'>" + $(this).next().html() + "</td></tr>");
}
});
}
现在在另一个类中,我想检查hfDetailsShown是否为真。如何在另一个类中调用hfDetailsShown?
if (hfDetailsShown == true)
{
//do something
}
发布于 2015-07-30 20:06:00
function ShowAll()
{
$(".ShowHide").each(function () {
if ($(this).html() == "Show") {
document.getElementById('<%= hfDetailsShown.ClientID %>').value = "true";
$(this).html("Hide");
$(this).closest("tr").after("<tr><td colspan = '999' style='padding:0px'>" + $(this).next().html() + "</td></tr>");
}
});
}
if (document.getElementById('<%= hfDetailsShown.ClientID %>').value== "true")
{
//do something
}
发布于 2015-07-30 20:14:17
我从您的问题中了解到的是,您希望检查hfDetailsShown的值。
var yourRequestedField = document.getElementById('<%= hfDetailsShown.ClientID %>').value;
https://stackoverflow.com/questions/31723173
复制相似问题