Question

I have a static class (SS.U) with a function (GP) that returns true or false. My problem is that this function is not triggered when I use it inside the <a> tag, but works fine inside an asp:LinkButton tag. I need both of them for some reasons. Here are my code lines:

1) <asp:LinkButton Visible='<%# SS.U.GP("EditContactImage") %>' runat="server" ID="LB1" Text="EditImage"/>

2) <a visible='<%# SS.U.GP("EditRelations") %>' runat="server" id="R1">EditRelations</a>

3) <a visible='false' runat="server" id="R2">EditRelations</a>

Line 1 and 3 are both working while line 2 always returns "visible = true". (Line 3 is included in the example for showing that the <a> tag actually has a working property called "visible"). I did set a breakpoint in the GP function noticing that only line 1 is using my function.
What can cause the <a> tag not perform the code?

Was it helpful?

Solution

Short answer: HTML controls do not support data binding.

Detailed answer here: When to use runat="server" on normal HTML

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top