Welcome Guest Search | Active Topics | Sign In | Register

ClientSideBeforeExecute not firing Options
Mark Rae
Posted: Tuesday, January 11, 2011 8:36:58 AM
Rank: Advanced Member
Groups: Member

Joined: 11/13/2008
Posts: 43
Hi,

I'm combining a Dialog and a CallbackPanel - the Dialog allows users to register for a free trial of my client's products.

However, when the user clicks the "Apply" button, the ClientSideBeforeExecute method doesn't seem to be called, i.e. the code branches straight to the server-side cmdApply_Click method.

I believe I have followed the example in the Demos_Callback_Features_Client_Event_Handler_Demo code, but I can't get it to work.

Code below.

Any assistance gratefully received.

Mark


Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="test2" %>
<%@ 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></title>
	<script type="text/javascript">
		var intKeyCode;

		function before_execute(callback)
		{
			return confirm('Are you sure?');
		}

		function handleKeyPress(evt)
		{
			intKeyCode = (window.event) ? event.keyCode : evt.which;
			return intKeyCode;
		}
		document.onkeydown = handleKeyPress;

		function dlgFreeTrial_Cancel()
		{
			if (intKeyCode == 27)
			{
				intKeyCode = 0;
			}
		}
	</script>

</head>
<body>
    <form id="form1" runat="server">
		<a href="#" title="Click here to apply for a free trial" onclick="eo_GetObject('dlgFreeTrial').show(true);">Show dialog</a> <asp:Label ID="lblTestPostback" runat="server" />
		<eo:Dialog runat="server" id="dlgFreeTrial" HeaderImageUrl="00020441" HeaderImageHeight="27" ClientSideOnCancel="dlgFreeTrial_Cancel" 
			MinHeight="100" MinWidth="150" AllowResize="False" ControlSkinID="None" 
			HeaderHtml='
"padding-top:5px">Free Trial</div>' BackColor="Blue" BackShadeColor="Blue" CloseButtonUrl="00020440" ConfineElementID=""> <HeaderStyleActive CssText="background-image:url(00020442);color:#444444;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-bottom:7px;padding-left:8px;padding-right:0px;padding-top:0px;" /> <ContentStyleActive CssText="background-color:White;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" /> <BorderImages BottomBorder="00020409,00020429" RightBorder="00020407,00020427" TopRightCornerBottom="00020405,00020425" TopRightCorner="00020403,00020423" LeftBorder="00020406,00020426" TopLeftCorner="00020401,00020421" BottomRightCorner="00020410,00020430" TopLeftCornerBottom="00020404,00020424" BottomLeftCorner="00020408,00020428" TopBorder="00020402,00020422" /> <ContentTemplate> <eo:CallbackPanel ID="cbFreeTrial" runat="server" Triggers="{ControlID:cmdApply;Parameter:}" ClientSideBeforeExecute="before_execute;"> <table> <tr> <td colspan="2" align="center"><h2 style="margin-top:0em;">Register for a Free Trial</h2></td> </tr> <tr> <td>Name</td> <td><asp:TextBox ID="txtName" runat="server" /></td> </tr> <tr> <td>Job title</td> <td><asp:TextBox ID="txtJobTitle" runat="server" /></td> </tr> <tr> <td> </td> <td><asp:Button ID="cmdApply" runat="server" Text="Apply" OnClick="cmdApply_Click" /></td> </tr> </table> </eo:CallbackPanel> </ContentTemplate> </eo:Dialog> </form> </body> </html>


Code: C#
using System;
using System.Web.UI.WebControls;

public partial class test2 : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{
		try
		{
			if (IsPostBack)
			{
				lblTestPostback.Text = "True";
			}
			else
			{
				lblTestPostback.Text = "False";
			}
		}
		catch (Exception ex)
		{
			CApplication.GlobalExceptionHandler(ex);
		}
	}

	protected void cmdApply_Click(object sender, EventArgs e)
	{
		string strTest = String.Empty;	// set a breakpoint on this line
	}
}
eo_support
Posted: Tuesday, January 11, 2011 1:57:38 PM
Rank: Administration
Groups: Administration

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

You have:

ClientSideBeforeExecute="before_execute;"

It should be:

ClientSideBeforeExecute="before_execute"

The property takes a function name.

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.