"Inline" function call: function is never hit

Posted by Shimrod on Stack Overflow See other posts from Stack Overflow or by Shimrod
Published on 2010-04-19T14:36:39Z Indexed on 2010/04/19 14:43 UTC
Read the original article Hit count: 223

Filed under:
|

Hi everybody.

I'm trying to make a tabbed menu for the asp.net website I'm working on. One of the pre-requisite is obviously to color the current tab differently, so the user can know on which tab is currently is.

To do this, I made this method in my code-behind:

Protected Function GetCssClass(ByVal ctrl As LinkButton) As String
        If ctrl.ID = currentLink Then
            Return "current"
        Else
            Return String.Empty
        End If
    End Function

and I call the method like this in my aspx page:

<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="/Default.aspx" CssClass="<%#GetCssClass(LinkButton1) %>" >Home</asp:LinkButton>                    
<asp:LinkButton ID="LinkButton2" runat="server" PostBackUrl="/Directory/page1.aspx" CssClass="<%#GetCssClass(LinkButton2) %>" >Page1</asp:LinkButton>

But the method is never hit... As I understand, the method should be called each time the LinkButton is drawn...

Does someone have an idea why?

Thanks in advance !

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net