Click here to Skip to main content
15,883,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a class Name PermissionControl in class folder.
when I use it in in inline code it doesn't fire
C#
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:
XML
<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!
Posted
Comments
Shahin Khorshidnia 10-Jun-12 12:01pm    
I don't access to VS right now, but I think it's "static". remove static from behind of the method and try again.
taha bahraminezhad Jooneghani 10-Jun-12 12:34pm    
no , I remove it and I get an error!
in another project it works good but here when I set a break point it doesn't work!

1 solution

Try:
<%= %> - Embedded Code Blocks instead of <%# %> as that is a Data-binding Expression.

Refer: Server side Delimiters in ASP.NET[^]
 
Share this answer
 
Comments
taha bahraminezhad Jooneghani 10-Jun-12 14:12pm    
no it doesn't work too!
Sandeep Mewara 11-Jun-12 2:08am    
My mistake, delimiters does not work on server controls.

I did a quick try and found this working:
<input type="button" id="bbn" value='<% =GetButtonText()%>' />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900