control that doen't run in an updatepanel

T

Trapulo

I'm trying to run a "captcha" web control. Full control source is available
here:
http://www.codeproject.com/aspnet/CaptchaControl.asp?forumid=124885&select=2250821&df=100&fr=76

It doesn't work if I put it in an UpdatePanel (ASP.NET Ajax), but I cannot
understand where is the problem. Basically I've an updatepanel with an asp
panel inside. This panel is not visible when the page is loaded, but
contains the captcha control. After the user select a command from the page
(a linkbutton external to the updatepanel), I make visible the panel. All
this is working: then captcha control is visibile, and I can see the image.
All other form fields and asp.net validators that are in the same panel work
well, but this control cannot be validated.

Any idea?

thanks
 
S

Steven Cheng[MSFT]

Hi Trapulo,

From your description, you're using a 3rd party validation code control and
found it won't work well within ASP.NET ajax update panel, correct?

As for this particular control, I've also downloaded the source and demo
and tested in my local environment. I found that the auhtor indicate that
you should disable the ViewState (in his sample page, he disabled the
<form>'s viewstate). I've tested the validation control in updatepanel and
with updatepanel's viewstate disabled and seems it can work correctly.
Would this be the cause of the problem you met?

BTW, for make custom control compatible with aspx updatepanel, here is a
forum aritcle maybe helpful:

#HOWTO: Write controls compatible with UpdatePanel without linking to the
ASP.NET AJAX DLL
http://forums.asp.net/p/1040033/1445844.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 
T

Trapulo

Hello Steven,
I've created a new blank project to investigate the problem. In fact,
starting with a blank page the control did work after I used the
updatePanel. But then I discovered what is that make it unworking.

I've created a simple schema as this, that is a simple model of my real and
original page:

<asp:UpdatePanel ID="UpdatePanel2" runat="server">

<ContentTemplate>

<asp:Button ID="btnShow" EnableViewState="false" runat="server" Text="show"
/>

</ContentTemplate>

</asp:UpdatePanel>

<div>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="False"
UpdateMode="Conditional">

<ContentTemplate>

<asp:panel ID="panelOne" runat="server" Visible="false"
EnableViewState="true">

<cc1:CaptchaControl ID="CaptchaControl1" runat="server" />

<asp:Button ID="Button1" runat="server" Text="Button" />

<asp:ValidationSummary ID="ValidationSummary1" runat="server" />

</asp:panel>

</ContentTemplate>

</asp:UpdatePanel>

</div>

I've just this code on codebehind:

Protected Sub btnShow_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnShow.Click

Me.panelOne.Visible = True

Me.UpdatePanel1.Update()

End Sub



I know that there are better way to create this behavor, but as I said this
is only a part of myoriginal page and UI logic :)

After I put the btnShow button in the updatePanel2, the captcha stopped
working. So I think that there is some error using ASP.NET Ajax, but I
cannot find where.



Thanks
 
T

Trapulo

I've found that if the updatePanel that contains the Captcha control has
Viewstate disable, it doesn't work in my scenario. If I enable it, then the
catcha works

BTW, can I ask you for a suggestion? This control stores "captcha codes" in
asp.net Cache. Can this be a performance or other kind of problem? Is it
better if I encrypt code and flow it as parameter in image url tag (<img
src="blabla.aspx?code=encryptedCode"), and in viewstate or other client side
store?
 
S

Steven Cheng[MSFT]

Thanks for your followup Trapulo,

For the further memory pressure issue, I'm wondering whether your
application will be a high available one that has large concurrent users,
if not, I think such cache usage would be ok. Otherwise, surely, you can
put the code into encrypted urlstring or page's html source.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Trapulo" <[email protected]>
References: <[email protected]>
Subject: Re: control that doen't run in an updatepanel
Date: Mon, 1 Oct 2007 16:30:52 +0200
 
T

Trapulo

Thank you

Steven Cheng said:
Thanks for your followup Trapulo,

For the further memory pressure issue, I'm wondering whether your
application will be a high available one that has large concurrent users,
if not, I think such cache usage would be ok. Otherwise, surely, you can
put the code into encrypted urlstring or page's html source.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no
rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top