我是使用ASP.NET的新手,我只是想问一下如何从用户控件中获取父页面并将其用作隐藏目录的条件
我尝试过使用
Equatable
但是由于var Pagechk = this.Page;
Page page = HttpContext.Current.Handler as Page;
if(Pagechk == "ASP.app_car_viewnewcarsdelivered_aspx")
{
lblCarDeliveryDate.Visible = false;
}
似乎永远无法正常工作
还尝试了cannot be applied to operand type of 'Page' and 'string'
,但是即使添加了Page
答案 0 :(得分:1)
如果要显示和隐藏HTML内容,可以使用CSS样式。 喜欢:
<div id="test"></div>
if(true){
test.Style.Add("display", "inherit");
}else{
test.Style.Add("display", "none");
}