1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AsyncUpdate.aspx.cs" Inherits="ZeeControls2Demo.WebDock.Advanced.AsyncUpdate" Theme="Default" %>
2
3 <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
4 Namespace="System.Web.UI" TagPrefix="asp" %>
5
6 <%@ Register Assembly="ZettaCube.ZeeControls" Namespace="ZettaCube.ZeeControls" TagPrefix="cc1" %>
7
8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
9
10 <html xmlns="http://www.w3.org/1999/xhtml" >
11 <head runat="server">
12 <title>Update Panel Status Asynchronously</title>
13 </head>
14 <body>
15 <form id="form1" runat="server">
16 <div>
17
18 <asp:ScriptManager ID="ScriptManager1" runat="server">
19 </asp:ScriptManager>
20
21 <cc1:WebDock ID="WebDock1" runat="server" Height="664px" Width="839px" FitParent="FitWindow">
22 <Panels>
23 <cc1:WebDockPanelGroup runat="server" Dock="Bottom" ID="PanelGroup1" PreferredSize="150">
24 <Panels>
25 <cc1:WebDockPanel runat="server" ID="Panel3">
26 <Tabs>
27 <cc1:WebDockTabbedPanel runat="server" ImageFileName="Properties.gif" Title="Connection Properties">
28 <Content>
29 <span style="background-color: darkseagreen"><strong>Panel3<br />
30 </strong>
31 Content of Connection Properties</span>
32 </Content>
33 </cc1:WebDockTabbedPanel>
34 <cc1:WebDockTabbedPanel runat="server" ImageFileName="Folders.gif" Title="Remote Folders">
35 <Content>
36 <span style="background-color: mediumorchid"><strong>Panel3<br />
37 </strong>
38 Content of Remote Folders</span>
39 </Content>
40 </cc1:WebDockTabbedPanel>
41 </Tabs>
42 </cc1:WebDockPanel>
43 <cc1:WebDockPanel runat="server" ID="Panel4">
44 <Tabs>
45 <cc1:WebDockTabbedPanel runat="server" ImageFileName="References.gif" Title="References">
46 <Content>
47 <span style="background-color: lightslategray"><strong>Panel4<br />
48 </strong>
49 Content of References</span>
50 </Content>
51 </cc1:WebDockTabbedPanel>
52 <cc1:WebDockTabbedPanel runat="server" ImageFileName="Servers.gif" Title="Servers">
53 <Content>
54 <span style="background-color: orchid"><strong>Panel4<br />
55 </strong>
56 Content of Servers</span>
57 </Content>
58 </cc1:WebDockTabbedPanel>
59 <cc1:WebDockTabbedPanel runat="server" ImageFileName="Toolbox.gif" Title="Toolbox">
60 <Content>
61 <span style="color: #ffff66; background-color: mediumblue"><strong>Panel4<br />
62 </strong>
63 Content of Toolbox</span>
64 </Content>
65 </cc1:WebDockTabbedPanel>
66 </Tabs>
67 </cc1:WebDockPanel>
68 </Panels>
69 </cc1:WebDockPanelGroup>
70 <cc1:WebDockPanel runat="server" ID="Panel1" PreferredSize="150">
71 <Tabs>
72 <cc1:WebDockTabbedPanel runat="server" ImageFileName="DocOutline.gif" Title="Document Outline">
73 <Content>
74 <span style="background-color: pink"><strong>Panel1<br />
75 </strong>
76 Content of Document Outline</span>
77 </Content>
78 </cc1:WebDockTabbedPanel>
79 <cc1:WebDockTabbedPanel runat="server" ImageFileName="Folders.gif" Title="Folders">
80 <Content>
81 <span style="background-color: lightgreen"><strong>Panel1<br />
82 </strong>Content of Folders</span>
83 </Content>
84 </cc1:WebDockTabbedPanel>
85 </Tabs>
86 </cc1:WebDockPanel>
87 <cc1:WebDockPanel runat="server" Dock="Right" ID="Panel2" PreferredSize="150">
88 <Tabs>
89 <cc1:WebDockTabbedPanel runat="server" ImageFileName="Properties.gif" Title="Properties">
90 <Content>
91 <span style="background-color: gold"><strong>Panel2<br />
92 </strong>Content of Properties</span>
93 </Content>
94 </cc1:WebDockTabbedPanel>
95 <cc1:WebDockTabbedPanel runat="server" ImageFileName="Folders.gif" Title="Events">
96 <Content>
97 <span style="background-color: paleturquoise"><strong>Panel2<br />
98 </strong>
99 Content of Events</span>
100 </Content>
101 </cc1:WebDockTabbedPanel>
102 </Tabs>
103 </cc1:WebDockPanel>
104 </Panels>
105 <TabStripProps ImagesFolderUrl="~/images/tabs" />
106 <MainContent>
107 <strong>
108 Update panel states asynchronously ...</strong><br />
109 ... without writing a single line of JavaScript!!!<br />
110 <br />
111 Say, you want to auto-hide/pin a dock panel during an AJAX request, all you need
112 to do is to set the DockingState property in the code-behind. The affected panel
113 doesn't need to be wrapped inside an UpdatePanel. ZeeControls will detect the change,
114 send it to the browser in the AJAX response, and update the panel's states accordingly.<br />
115 <br />
116 Benefits: ease of programming, minimal network traffic.<br />
117 <br />
118 <span style="font-size: 8pt">(On this page, only the following panel with a blue border
119 is an UpdatePanel.)<br />
120 </span>
121 <br />
122 <div style="border: 2px blue solid">
123 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
124 <ContentTemplate>
125 Panel ID
126 <asp:DropDownList ID="ddlPanelId" runat="server" AutoPostBack="True">
127 <asp:ListItem>Panel1</asp:ListItem>
128 <asp:ListItem>Panel2</asp:ListItem>
129 <asp:ListItem>Panel3</asp:ListItem>
130 <asp:ListItem>Panel4</asp:ListItem>
131 <asp:ListItem>PanelGroup1</asp:ListItem>
132 </asp:DropDownList><br />
133 DockingState
134 <asp:DropDownList ID="ddlDockingState" runat="server">
135 <asp:ListItem Value="0">Pinned</asp:ListItem>
136 <asp:ListItem Value="1">AutoHidden</asp:ListItem>
137 <asp:ListItem Value="2">Maximized</asp:ListItem>
138 <asp:ListItem Value="3">Hidden</asp:ListItem>
139 </asp:DropDownList><br />
140 PreferredSize
141 <asp:TextBox ID="tbPreferredSize" runat="server" Width="45px"></asp:TextBox><br />
142 ActiveTabIndex
143 <asp:TextBox ID="tbActiveTabIndex" runat="server" Width="39px"></asp:TextBox><br />
144 <asp:Button ID="btnUpdate" runat="server"
145 Text="Update" OnClick="btnUpdate_Click" />
146 </ContentTemplate>
147 </asp:UpdatePanel>
148 </div>
149 <br />
150 If you prefer, you can use the <a href="ClientApi.aspx">Client API</a> to update the states at the client-side.
151 </MainContent>
152 <ActionButtonProps ShowClose="True" ShowMaximize="True" />
153 </cc1:WebDock>
154
155 </div>
156 </form>
157 </body>
158 </html>
159
1 using System;
2 using System.Data;
3 using System.Configuration;
4 using System.Collections;
5 using System.Web;
6 using System.Web.Security;
7 using System.Web.UI;
8 using System.Web.UI.WebControls;
9 using System.Web.UI.WebControls.WebParts;
10 using System.Web.UI.HtmlControls;
11
12 using ZettaCube.ZeeControls;
13
14 namespace ZeeControls2Demo.WebDock.Advanced
15 {
16 public partial class AsyncUpdate : System.Web.UI.Page
17 {
18 protected void Page_Load(object sender, EventArgs e)
19 {
20 }
21
22 protected override void OnPreRender(EventArgs e)
23 {
24 RefreshStates();
25 base.OnPreRender(e);
26 }
27
28 private void RefreshStates()
29 {
30 // Gets the states of the selected panel and displays in various input boxes
31 string panelId = ddlPanelId.SelectedValue;
32
33 // In addition to referring a WebDockPanel object by its ID, such as, Panel1.PreferredSize = ...
34 // we can get the object reference by its ID with FindPanel() method.
35 // Note that the object returned could be a WebDockPanel, WebDockUpdatePanel, or WebDockPanelGroup
36 WebDockPanelBase panel = WebDock1.FindPanel(panelId);
37
38 if (panel is WebDockPanel)
39 {
40 // panel is a WebDockPanel or WebDockUpdatePanel
41 WebDockPanel dp = panel as WebDockPanel;
42 ddlDockingState.Enabled = true;
43 tbActiveTabIndex.Enabled = true;
44 ddlDockingState.SelectedValue = Convert.ToInt32(dp.DockingState).ToString();
45 tbActiveTabIndex.Text = dp.ActiveTabIndex.ToString();
46 }
47 else
48 {
49 // panel is a WebDockPanelGroup
50 ddlDockingState.Enabled = false;
51 tbActiveTabIndex.Enabled = false;
52 }
53 tbPreferredSize.Text = panel.PreferredSize.ToString();
54 }
55
56 protected void btnUpdate_Click(object sender, EventArgs e)
57 {
58 string panelId = ddlPanelId.SelectedValue;
59 WebDockPanelBase panel = WebDock1.FindPanel(panelId);
60
61 if (panel is WebDockPanel)
62 {
63 // panel is a WebDockPanel or WebDockUpdatePanel
64 WebDockPanel dp = panel as WebDockPanel;
65 dp.DockingState = (WebDockPanelStateEnum)(Convert.ToInt32(ddlDockingState.SelectedValue));
66 dp.ActiveTabIndex = Convert.ToInt32(tbActiveTabIndex.Text);
67 }
68 panel.PreferredSize = Convert.ToInt32(tbPreferredSize.Text);
69 }
70 }
71 }
72
1 body
2 {
3 font-family: Tahoma, Geneva;
4 font-size: 10pt;
5 }
6
7 .ZCWDMainContent, .ZCWDPanelContent
8 {
9 padding: 3px;
10 }
11
12 .ZCWDPanelTitleBar
13 {
14 padding-left: 3px;
15 }
16
17 .ZCWSPanel
18 {
19 padding: 3px;
20 }
21
22 .title
23 {
24 display: block;
25 font-weight:bold;
26 line-height: 24px;
27 }
28
29 .indent
30 {
31 padding: 10px;
32 padding-left: 30px;
33 }
34
35 .blah
36 {
37 color: Gray;
38 }
39
40 .tableRowHeader
41 {
42 color: #666666;
43 }
44
45 .tableColumnHeader
46 {
47 color: #666666;
48 }
49
1 <%--
2 Default skin template. The following skins are provided as examples only.
3
4 1. Named control skin. The SkinId should be uniquely defined because
5 duplicate SkinId's per control type are not allowed in the same theme.
6
7 <asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >
8 <AlternatingRowStyle BackColor="Blue" />
9 </asp:GridView>
10
11 2. Default skin. The SkinId is not defined. Only one default
12 control skin per control type is allowed in the same theme.
13
14 <asp:Image runat="server" ImageUrl="~/images/image1.jpg" />
15 --%>