内联代码不触发方法 [英] inline code doesn't fire method
本文介绍了内联代码不触发方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在类文件夹中有一个类名称PermissionControl.
当我在内联代码中使用它时不会触发
I have a class Name PermissionControl in class folder.
when I use it in in inline code it doesn''t fire
public class PermissionControl
{
private static readonly HttpSessionState Session = HttpContext.Current.Session;
private static readonly HttpApplicationState Application = HttpContext.Current.Application;
public static bool CheckPermission(string PermissionConstantName)
{
//my code
}
}
我在这里称呼它:
and I call it here:
<asp:LinkButton ID="btn1" Visible='<%# CustomPermission.Class.PermissionControl.CheckPermission("Install") %>' runat="server">install module</asp:LinkButton>
为什么方法不触发?
我什至设置了一个断点,但甚至没有调用我的方法!
why method doesn''t fire?
I even set a break point but don''t even call my method!
推荐答案
Try:
<%= %>
-嵌入式代码块而不是<%# %>
,因为这是一个数据绑定表达式.
请参考: ASP.NET中的服务器端分隔符 [ ^ ]
Try:
<%= %>
- Embedded Code Blocks instead of<%# %>
as that is a Data-binding Expression.
Refer: Server side Delimiters in ASP.NET[^]
这篇关于内联代码不触发方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文