Not a subscriber?

Join thousands of others who are building self-directed lives through creativity, grit, and digital strategy—breaking free from the 9–5.
Receive one free message a week

ASP.NET AJAX Always Visible Control Frustrations

Unfortunately I don’t have time to go through and figure out why the Always Visible control wont work with a user control. Although I assume it has something to do with the HTML DOM. Some relationship in there is probably hard coded or assumed.

Here’s what I was trying to do:

I want to have an always visible control that had some items in it (lets say a bunch of links). I wanted that to be in a user control. I wanted that user control to be the “always visible” control. So I set the TargetID to the user control and … NO DICE. Doesn’t work. I get a cannot load behavior ID or something like that. Its a JavaScript error, and I could figure it out if I had time, but unfortunately the project I’m on doesn’t permit.

I even attempted to get around this by putting all of the ASP.NET AJAX into a user control and then add the user control to the page. NOPE, didn’t work.

Solution

This is kind of a hacky solution, but it works. You can get this to work by putting all of your controls into a user control. Then wrap your user control in a panel. Like so:

<ajaxToolkit:AlwaysVisibleControlExtender
    ID=”avce” runat=”server”
    VerticalSide=”bottom”
    TargetControlID=”scrollingPanel”
    VerticalOffset=”10″
    HorizontalSide=”Right”
    HorizontalOffset=”10″
    ScrollEffectDuration=”.1″ />
<asp:Panel runat=”server” ID=”scrollingPanel”>
    <uc1:MyUserControl ID=”myUc” runat=”server”  />
</asp:Panel>

This will allow you to still use a user control, but in my opinion, its kind of hacky. If and when I find time to work around this I’ll post an update. If anyone else knows of a fix, please let me know.