Welcome Guest Search | Active Topics | Sign In | Register

MultiPage visibility and CallbackPanel Options
Samuele
Posted: Wednesday, July 25, 2007 10:19:55 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 58
Hi,

I post the code directly so its easily..

Code: HTML/ASPX
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="CorEuroMach.WebForm1"%>
<%@ Register TagPrefix="eo" Namespace="EO.Web" Assembly="EO.Web" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>WebForm1</title>
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
	</HEAD>
	<body>
		<form id="Form1" method="post" runat="server">
			<eo:CallbackPanel id="CallbackPanel1" runat="server" Height="150px" Width="200px" Triggers="{ControlID:TabStrip1;Parameter:}">
				<eo:TabStrip id="TabStrip1" runat="server" Width="350px" ControlSkinID="Simple_Gray" RaisesServerEvent="True">
					<TopGroup>
						<Items>
							<eo:TabItem Text-Html="Tab1"></eo:TabItem>
							<eo:TabItem Text-Html="Tab2"></eo:TabItem>
						</Items>
					</TopGroup>
				</eo:TabStrip>
				<eo:TabStrip id="TabStrip2" runat="server" Width="350px" ControlSkinID="Simple_Gray" MultiPageID="MultiPage1"
					Visible="False">
					<TopGroup>
						<Items>
							<eo:TabItem Text-Html="Tab3"></eo:TabItem>
							<eo:TabItem Text-Html="Tab4"></eo:TabItem>
						</Items>
					</TopGroup>
				</eo:TabStrip>
				<eo:MultiPage id="MultiPage1" runat="server" Height="180px" Width="100%" Visible="False">
					<eo:PageView id="PageView1" runat="server" Width="100%">Tab 3</eo:PageView>
					<eo:PageView id="PageView2" runat="server" Width="100%">Tab 4</eo:PageView>
				</eo:MultiPage>
			</eo:CallbackPanel>
		</form>
	</body>
</HTML>


Code: Visual Basic.NET
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Sub CallbackPanel1_Execute(ByVal sender As System.Object, ByVal e As EO.Web.CallbackEventArgs) Handles CallbackPanel1.Execute
        Me.MultiPage1.Visible = (Me.TabStrip1.SelectedIndex <> 0)
        Me.TabStrip2.Visible = (Me.TabStrip1.SelectedIndex <> 0)
    End Sub


When i select Tab2 i get an error.
If i delete the CallbackPanel all work fine.
Where i wrong?

Very Thanks
Samuele
eo_support
Posted: Wednesday, July 25, 2007 11:37:51 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Samuele,

The problem occurs because when TabStrip2 is being initialized, MultiPage1 has not been initialized yet. So TabStrip2 was not able to see MultiPage1. Without a CallbackPanel, such initialization is triggered by the onload event, at which point all objects already exists. However this is not possible during an AJAX callback.

In order to get around this problem, you can put MultiPage1 inside a div:

Code: HTML/ASPX
<div runat="server" id="MultiPageContainer" style="display:none">
    ...MultiPage1 goes here...
</div>


In your server code, you can do:

Code: C#
MultiPageContainer.Style["display"] = "block";


or

Code: C#
MultiPageContainer.Style["display"] = "none";


To show/hide the MultiPage. Note at here you do not use the Visible property.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.