I have two Webpartzones on my page in given below manner:
<asp:WebPartZone ID="Left" WebPartVerbRenderMode="TitleBar" runat="server" CssClass="PartZone" >
<MinimizeVerb Text="Minimize" Enabled="true" />
<RestoreVerb Text="Restore" Enabled="true" />
<CloseVerb Text="Close" Enabled="true" />
<ZoneTemplate>
<REAMS:TotoalEnergyGenerated runat="server" ID="TotEneryGen" />
<REAMS:NoOfSystemsOnline runat="server" ID="OnlineSys" />
<REAMS:WeatherInfo Title=" " ID="WeatherInfoExec" runat="server" />
<REAMS:AssetMap ID="AssetMapExec" runat="server" />
</ZoneTemplate>
</asp:WebPartZone>
<asp:WebPartZone ID="Bottom" WebPartVerbRenderMode="TitleBar" runat="server" CssClass="PartZone" >
<MinimizeVerb Text="Minimize" Enabled="true" />
<RestoreVerb Text="Restore" Enabled="true" />
<CloseVerb Text="Close" Enabled="true" />
<ZoneTemplate>
<REAMS:ProjectSummary ID="Project" runat="server" />
</ZoneTemplate>
</asp:WebPartZone>
as it is evident, webpartzone left
has four gadgets(controls) in it and webpartzone bottom
has one. So for the first time, for any given user, left shows four and bottom
shows one gadget. Now, suppose user closes one of the 4 gadgets and now left
has just three gadgets. Next time he comes and finds the page layout as per his previous modifications.
I have these gadgets as UserControls. These usercontrols have public methods to hit the database and perform some logic and get data and I call these public methods on the webpart page(and not on the uc itself). i.e. ucGadget1.LoadData();
here's my problem: I want to load only those gadgets(UCs) which are not closed by the user i.e. which are visible when the webpart page loads. Am unable to find difference between a webpart kept on the page but not visible and a webpart kept on the page and visible. Because all the properties of these webparts are the ones that is being written on the designer.I need those which get rendered at the runtime(and through the ASP.NET Personalization Tables)
(please consider gadget = webpart)
here's my problem: I want to load only those gadgets(UCs) which are not closed by the user i.e. which are visible when the webpart page loads. Am unable to find difference between a webpart kept on the page but not visible and a webpart kept on the page and visible
When user closes the window or moves to another page, you can check the visibility of the control using following code...
var ID = document.getElementById('ID of the control');
This code will be written in OnBeforeUnLoad
Event
Reference
OnBeforeUnload event of Javascript
In case this ID is returning you the memory that means control is present otherwise it is hidden and the control is not rendered as HTML.
Now you can call the server method using AJAX/JQuery. This method will update the control visibility Bit(High/Low) in database or where ever you want....
Hope this will help you...
Query
By closing the control means setting the
?