我正在尝试获取页面的类型,并将其分配给 div 的 ID。
我试过:
<div id="<%= this.Page.GetType().Name %>" class="website-content">
但是我得到了它的形式
master_page_name_aspx
我也试过
<div id="<%= this.Page.GetType().GetType().Name %>" class="website-content">
但它产生了RuntimeType
例如,我想要获取 EditUser,或者调用页面 Web 表单类的任何内容。
我怎样才能做到这一点?
请您参考如下方法:
你想要的可能是:
<div id="<%= this.Page.GetType().BaseType.Name %>" class="website-content">
因为 GetType().GetType() 只会返回相同的类型,无论您调用它多少次。
