Welcome Guest Search | Active Topics | Sign In | Register

callbackcontrol.redirect not working correctly Options
Mike Bourne
Posted: Thursday, July 3, 2008 5:22:36 PM
Rank: Member
Groups: Member

Joined: 7/2/2007
Posts: 16
Problem:

When the user clicks on the "Cancel" button, the page is not redirected, instead the same page is re-displayed. what am I doing wrong, I am sure it's something very simple :)

Environment:

Visual Studio 2008 running Net 2.0 Framework and ES's 2007.2 version of controls.

Thanks in advance and Happy 4th of July!

Mike



ASP.NET

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<%@ Register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">

.text
{
font-family: Verdana, 'Times New Roman';
text-align: Left;
font-size: 10pt;
}
.Text
{
font-family: Verdana, 'Times New Roman';
text-align: Left;
font-size: 10pt;
}
.TextBold
{
font-family: Verdana, 'Times New Roman';
text-align: Left;
font-weight: Bold;
font-size: 10pt;
}
.BoldText
{
font-family: Verdana, 'Times New Roman';
text-align: right;
font-weight: Bold;
font-size: 10pt;
}
.CancelButtonRed
{
font-family: Verdana, 'Times New Roman';
font-size: 10pt;
width: 100px;
color: Red;
font-weight: Bold;
text-align: Center;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Label ID="lblstatus" runat="server" Font-Bold="True" Font-Names="verdana" Font-Size="10pt" Width="100%"></asp:Label>
<br />
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<eo:CallbackPanel ID="cbMultiPage" runat="server" Height="100%"
Triggers=""
Width="100%" style="font-size: xx-small"
ClientSideBeforeExecute="" GroupName=""
LoadingDialogID="" LoadingPanelID=""
LoadingHTML="">
<eo:TabStrip ID="TabStrip1" runat="server" ControlSkinID="None"
MultiPageID="mp1" TopLevelItemAlign="None"
DesignOptions-BackColor="239, 235, 222">
<TopGroup Orientation="Horizontal" Style-CssClass="CenterBold">
<Items>
<eo:TabItem Text-Html="Page 1">
</eo:TabItem>
<eo:TabItem Text-Html="Page 2">
</eo:TabItem>
<eo:TabItem Text-Html="Page 3">
</eo:TabItem>
<eo:TabItem Text-Html="Page 4">
</eo:TabItem>
<eo:TabItem Text-Html="Page 5">
</eo:TabItem>
<eo:TabItem Text-Html="Page 6">
</eo:TabItem>
<eo:TabItem Text-Html="Page 7">
</eo:TabItem>
</Items>
</TopGroup>
<LookItems>
<eo:TabItem Image-BackgroundRepeat="RepeatX" Image-Mode="TextBackground"
Image-SelectedUrl="00010205" Image-Url="00010202" ItemID="_Default"
LeftIcon-SelectedUrl="00010204" LeftIcon-Url="00010201"
RightIcon-SelectedUrl="00010206" RightIcon-Url="00010203"
Text-HorizontalAlign="Center">
<SubGroup OverlapDepth="8"
Style-CssText="font-family: tahoma; font-size: 8pt; background-image: url(00010200); background-repeat: repeat-x; cursor: hand;">
</SubGroup>
</eo:TabItem>
</LookItems>
</eo:TabStrip>
<eo:MultiPage ID="mp1" runat="server" Height="180px"
Width="100%">
<eo:PageView ID="pv1" runat="server" Width="100%"
BorderStyle="Solid">
<table class="Text" style="width: 1015px; height: 271px; margin-right: 18px;">
<tr>
<td class="TextBold" style="width: 175px">
&nbsp;</td>
<td style="width: 145px">
&nbsp;</td>
<td style="width: 159px">
&nbsp;</td>
<td class="BoldText" colspan="3">
<asp:Label ID="lblMode" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="width: 175px; height: 15px">
&nbsp;</td>
<td style="height: 15px; width: 145px;">
&nbsp;</td>
<td style="width: 159px; height: 15px; text-align: right">
&nbsp;</td>
<td style="height: 15px; width: 51px">
&nbsp;</td>
<td style="height: 15px; width: 87px;">
&nbsp;</td>
<td style="height: 15px; width: 214px;">
&nbsp;</td>
</tr>
<tr>
<td colspan="2">
&nbsp;</td>
<td colspan="4" style="text-align: right;">
&nbsp;</td>
</tr>
<tr>
<td colspan="3">
&nbsp;</td>
<td colspan="3">
&nbsp;
</td>
</tr>
<tr>
<td align="left" class="BoldText" colspan="2" style="text-align: center">
&nbsp;</td>
<td align="center" class="BoldText" colspan="3" style="text-align: center">
&nbsp;</td>
<td align="center" class="BoldText" style="text-align: center">
&nbsp;</td>
</tr>
<tr>
<td colspan="2">
&nbsp;</td>
<td colspan="4" valign="top">
&nbsp;</td>
</tr>
<tr>
<td class="TextBold" colspan="2" style="height: 3px">
</td>
<td style="width: 159px; height: 3px;">
</td>
<td colspan="3" style="height: 3px">
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;</td>
<td colspan="4">
&nbsp;</td>
</tr>
<tr valign="top">
<td colspan="2" style="height: 103px" valign="top">
<table style="width:96%;">
<tr>
<td class="Text" style="text-align: right; width: 126px">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td style="text-align: right; width: 126px">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td style="text-align: right; width: 126px">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td colspan="2" style="text-align: left; ">
&nbsp;</td>
</tr>
<tr>
<td style="text-align: right; width: 126px">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td style="text-align: right; width: 126px">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td style="text-align: right; width: 126px">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td style="text-align: right; width: 126px">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td style="width: 126px; text-align: right" valign="top">
<asp:Button ID="btnCancel" runat="server"
CssClass="CancelButtonRed" Text="Cancel" Width="100px"
CausesValidation="False" UseSubmitBehavior="False" />
</td>
<td valign="top">
&nbsp;</td>
</tr>
</table>
</td>
<td colspan="4" style="height: 103px">
<table style="width:101%;">
<tr>
<td class="Text" style="text-align: right; width: 126px">
&nbsp;</td>
<td style="width: 196px">
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td style="text-align: right; width: 126px">
&nbsp;</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td style="text-align: right; width: 126px">
&nbsp;</td>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td style="text-align: right" colspan="3">
&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="6">
&nbsp;</td>
</tr>
<tr>
<td colspan="6">
<asp:HiddenField ID="hdnMode" runat="server" Value="none" />
<asp:HiddenField ID="hdnLastBtnClicked" runat="server" />
</td>
</tr>
<tr>
<td colspan="6">
&nbsp;</td>
</tr>
<tr>
<td style="width: 175px">
&nbsp;</td>
<td style="width: 145px">
&nbsp;</td>
<td style="width: 159px">
&nbsp;</td>
<td colspan="3">
&nbsp;</td>
</tr>
</table>
</eo:PageView>
<br />
<br />
</eo:MultiPage>
</eo:CallbackPanel>
<br />
<br />
<br />
<br />
<br />
<br />
<br />



</div>
</form>
</body>
</html>




VB.NET Code


Partial Class Default2
Inherits System.Web.UI.Page


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'EO.Web.Runtime.DebugLevel = 1

If Page.IsPostBack Then
Else
btnCancel.Attributes.Add("onclick", "if(confirm('Are you sure you want CANCEL and EXIT?')){}else{return false}")
End If
End Sub

Protected Sub SetStatus(ByVal TextMsg As String, ByVal ForeColor As Drawing.Color, ByVal BoldFont As Boolean)
lblstatus.Text = TextMsg
lblstatus.ForeColor = ForeColor
lblstatus.Font.Bold = BoldFont
End Sub

Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Try
hdnLastBtnClicked.Value = sender.Text.ToString
'ExitApplicatons()

cbMultiPage.Redirect("Default.aspx")

Catch ex As Exception

End Try
End Sub

End Class
eo_support
Posted: Thursday, July 3, 2008 7:31:24 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

CallbackPanel.Redirect only works when you are actually inside an AJAX callback. In your case, Cancel button is not set as a trigger so it will just trigger a normal postback which has nothing to do with the callback at all. In fact the CallbackPanel in your page is not event being put on use because it has no triggers.

Thanks
Mike Bourne
Posted: Sunday, July 6, 2008 8:51:57 PM
Rank: Member
Groups: Member

Joined: 7/2/2007
Posts: 16
I added the "Cancel" to the triggers on the callback panel and the same issue still applies. This time the error message reads:


Windows Internet Explorer

EO.Web Controls Client Side Debug Message:



EO.Web control 'ctl00_MAIN_cbMultiPage' error message (set ClientSideOnError to handle this error):The callback on 'ctl00_MAIN_cbMultiPage' has failed because the server did not recognize this callback and processed it as a normal request. This can occur if there are multiple Callback/CallbackPanel controls in the page, and this Callback/CallbackPanel control was initially dynamically loaded but wasn't loaded for this callback.



This can also occur if you have called Response.Redirect on the server side. Callback/CalbackPanel provides a Redirect method for such scenario. Please use the Callback/CallbackPanel's Redirect method in this case.



You can turn off this message by setting EO.Web.Runtime.DebugLevel to 0 (Not recommended for debug build).

OK

eo_support
Posted: Sunday, July 6, 2008 9:07:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

The problem mostly has to do with dynamic loading code. In fact we verified the code that you posted, which does not involve dynamic loading and it worked perfectly fine.

Dynamic loading is an advanced ASP.NET topic which itself would be outside of the scope of our support. You may find the following post useful:

http://essentialobjects.com/Forum/Default.aspx?g=posts&t=1179#5018

The general rule is, the CallbackPanel that you are triggering must be there when the page is posted back to the server. When it is not there, you will get that message. This is actually a fundamental ASP.NET rule that applies to all server controls, not just the CallbackPanel.

Hope this helps.

Thanks

Mike Bourne
Posted: Monday, July 7, 2008 12:21:26 AM
Rank: Member
Groups: Member

Joined: 7/2/2007
Posts: 16
This doesn't make sense, why would the callback not be present if I haven't left the page. I am simply clicking on a
"cancel" button that resides on the pageview within the callback panel. Again why would the callback notbe present. I am NOT loading anything dynamically.

Puzzeled!
eo_support
Posted: Monday, July 7, 2008 12:26:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
We tried the code you posted on the latest version and it works fine. So you may want to check your version. Please post a test page that demonstrates the problem if you continue to have problem.

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.