Wednesday, March 28, 2012

Postback problem using a usercontrol inside an update panel that is inside a masterpage

Hi all,

I have been messing around with this all day and its starting to get on my nerves i'm probably missing something really simple but I was hoping someone could shed some light on it or perhaps point me in the right direction..

As I said in thesubject of the post, I have a user control inside an update panel, that resides in the master page, now my problem is when the user control goes to perform a post back I get that nasty "Invalid callback or postback argument error" Can someone help me to rectify this issue? Basically all the control needs to do is hide one panel inside it and show another on a link buttons click even.. There is other code in there too..

The simplified code for the master page is as follows..

<%

@dotnet.itags.org.MasterLanguage="VB"CodeFile="redcellar.master.vb"Inherits="redcellar" %>

<%

@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

<%

@dotnet.itags.org.RegisterSrc="login.ascx"TagName="login"TagPrefix="uc2" %>

<%

@dotnet.itags.org.RegisterSrc="controls/memberdeals.ascx"TagName="memberdeals"TagPrefix="uc1" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en">

<

headrunat="server"><metahttp-equiv="content-type"content="text/html;charset=utf-8"/><linkrel="stylesheet"type="text/css"media="screen, projection"href="stylesheets/screen.css"/><!--[if lte IE 6]>

<link rel="stylesheet" type="text/css" media="screen, projection" href="http://links.10026.com/?link=stylesheets/screen-ie.css" /><![endif]-->

<linkrel="stylesheet"type="text/css"media="screen, projection"href="stylesheets/order.css"/><!--[if lte IE 6]>

<link rel="stylesheet" type="text/css" media="screen, projection" href="http://links.10026.com/?link=stylesheets/order-ie.css" /><![endif]-->

<scripttype="text/javascript"src="scripts/borders.js"></script><scripttype="text/javascript"src="scripts/misc.js"></script><title></title>

</

head>

<

body><formid="form1"runat="server"><asp:ScriptManagerEnablePartialRendering="true"ID="masterScriptManager"runat="server"/><asp:UpdatePanelID="masterUpdatePanel"runat="server"><ContentTemplate><!-- container --><divid="container">

<p>page content is here</p>

</div><uc2:loginID="Login1"runat="server"/></ContentTemplate></asp:UpdatePanel>

And the code for the control is:

<%

@dotnet.itags.org.ControlLanguage="VB"Debug="true"AutoEventWireup="false"CodeFile="login.ascx.vb"Inherits="login"Strict="true" %><asp:PanelID="pnlLoginContainer"CssClass="modalPopup"runat="server"><divid="normal"><asp:PanelID="pnlLogin"runat="server"style="overflow: auto;"><divstyle="width: 160px; float: right;"><asp:linkbuttonID="lbClose"cssclass="modalClose"Text=""runat="server"/><asp:ImageID="Image1"runat="server"ImageUrl="~/images/member-red-large.gif"/></div><div><br/><h3id="normalpage_heading">

Member sign in.

</h3><br/><asp:LabelID="Label1"runat="server">Welcome back!</asp:Label><br/><br/><tablecellspacing="0"><trclass="datarow"><tdclass="itemheader"><asp:LabelID="Label2"runat="server"Text="email"/></td><tdclass="itemcontent"colspan="2"><asp:TextBoxID="txtEmail"runat="server"MaxLength="255"/></td></tr><trclass="datarow"><tdclass="itemheader"><asp:LabelID="Label3"runat="server"Text="password"/></td><tdclass="itemcontent"colspan="2"><asp:TextBoxID="txtPassword"runat="server"MaxLength="50"TextMode="Password"/><asp:RequiredFieldValidatorID="RequiredFieldValidator1"runat="server"ControlToValidate="txtpassword"Display="Dynamic"ErrorMessage="*"/></td></tr><trclass="datarow"><tdclass="itemheader"> </td><tdclass="itemcontentsmall"><asp:CheckBoxID="chkRememberMe"runat="server"Text="remember me"/></td><tdclass="itemcontentsmall"style="text-align: right;"><asp:LinkButtonID="lbForgotPassword"runat="server"CausesValidation="False"Text="forget your password?"/></td></tr></table><br/><divclass="link"id="signin-link"><asp:LinkButtonID="cmdLogin"runat="server"Text="sign in"/></div><br/><asp:LabelID="lblLoginMsg"runat="server"ForeColor="Red"></asp:Label><br/></div><div><asp:LabelID="Label4"runat="server">Are you a new user? You must register</asp:Label><asp:LinkButtonID="lbRegister"runat="server"CausesValidation="False"Text="here!"ToolTip="Click here to register.">here!</asp:LinkButton></div></asp:Panel><asp:PanelID="pnlForgotPass"runat="server"Width="100%"style="overflow: auto;"Visible="False"><divstyle="width: 160px; float: right;"><asp:linkbuttonID="Linkbutton1"cssclass="modalClose"Text=""runat="server"/><asp:ImageID="Image2"runat="server"ImageUrl="~/images/member-red-large.gif"/></div><div><p>

Forgot you password?

</p><asp:LabelID="Label5"runat="server">email</asp:Label><asp:TextBoxID="txtForgotPassEmail"runat="server"></asp:TextBox><asp:RequiredFieldValidatorID="RequiredFieldValidator2"runat="server"ControlToValidate="txtForgotPassEmail"Display="Dynamic"ErrorMessage="*"></asp:RequiredFieldValidator><asp:RegularExpressionValidatorID="RegularExpressionValidator1"runat="server"ErrorMessage="You must enter a valid email!"ControlToValidate="txtForgotPassEmail"SetFocusOnError="True"ValidationExpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@dotnet.itags.org.([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"Display="Dynamic"></asp:RegularExpressionValidator><br/><br/><asp:LabelID="lblResponseMessage"runat="server"></asp:Label><br/><pstyle="text-align: right;"><asp:ButtonID="cmdForgotPass"runat="server"Text="submit"/> </p></div></asp:Panel></div></asp:Panel>

The relevant code behind for this is:

ProtectedSub lbForgotPassword_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles lbForgotPassword.Click

pnlLogin.Visible =

False

pnlForgotPass.Visible =

TrueEndSub

Some help with this would be greatly appreciated.. :)

I'm still stuck with this one :S Any ideas?


After eliminating one thing at a time in my masterpage I found that this was the culprit, commenting it out did the trick..

<form method="get" action="">
<p><label for="search">Find a wine:</label>
<input type="text" id="search" onfocus="if(value=='eg: Henschke') value=''" value="eg: Henschke" />
<input type="image" src="http://pics.10026.com/?src=images/go.gif" value="Go" id="go" /></p>
</form>


does anyone have any idea why??

No comments:

Post a Comment