Delving Deeper into Constructing ASP.NET AJAX-based Applications - Keeping the Statistics Info Always Visible
(Page 3 of 4 )
Sometimes, keeping something always floating and visible at some special position of the page will achieve a better advertising effect (despite causing some impoliteness to customers). What is appropriate to make always visible in JSSK is the statistics info at the top right corner. The idea is that, however users scroll the page, the information remains stuck in that "fixed" visible place.
Well, by using the Extender control-AlwaysVisibleControl, the above requirement can be easily met.
First of all, we should notice that the statistic info in JSSK is implemented by a UserControl named Statistics.ascx. Opening the control, we will find that all the contents are encapsulated by a HTML <table> label. Since any object to be extended by the Extender control must be some ASP.NET server-side control, the first thing for us to do is to convert the original HTML <table> label into a server control. With a little modification, we can see the related part of code, as follows.
<table id="statistics" cellspacing="0" cellpadding="5" border="1" runat="server">
<tr>
<td nowrap="nowrap" align="center" colspan="2">
<asp:Label ID="Label4" Text="Jobs/Resumes Stats" runat="server" SkinID="FormLabel"></asp:Label>
Note here we merely need to keep the statistic info always visible to the administrator, and thus we will put the AlwaysVisibleControl control inside the LoginView control in JSSK. Since ASP.NET LoginView strays from the point, we won't dwell much on it.
Next, we need to add the declaration for the AlwaysVisibleControl control within the <ContentTemplate> block:
<ajaxToolkit:AlwaysVisibleControlExtender ID="avce" runat="server" TargetControlID="statistics"
VerticalSide="Top" VerticalOffset="100" HorizontalSide="Right" HorizontalOffset="2"
ScrollEffectDuration=".1" />
Note that the above TargetControlID property points to the <table> server control that has been converted just now. That's all; you can press F5 and test it.
Next: Using the ConfirmButton Extender Control When Necessary >>
More ASP.NET Articles
More By Xianzhong Zhu