Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Captcha Web Control - Maintaining ViewStateCaptcha Web Control - Maintaining ViewState
Previous
 
Next
New Post
5/27/2008 3:41 PM
 

Hi guys... We have several modules and areas of code that dynamically add the DNN Captcha web control to a page. We are running into issues between postbacks with maintaing the controls viewstate. Here is the basics...

1. Between postbacks if the page changes (as far as what controls are there, which controls are not there, etc...) and Captcha is present the the entire page creates a viewstate error.

2. If I turn CaptchaControl.EnableViewState = False - Then I get no errors for failed to load viewstate upon postback, however I don't have access to that property of what the correct Captcha field is. 

I have tried and tested several options but I keep running into viewstate problems. If EnableViewState=True is set and the page posts back with different controls being displayed/not displayed then the control will throw a viewstate error, if the EnableViewState=False then the control doesn't throw any errors however I have no access to what the image is.

 

Any ideas?

 

-Chad

 

 
New Post
5/28/2008 1:31 AM
 

asp.net does not have the ability to manage viewstate for dynamic controls by default.

Is the captchcontrol the only control that is being loaded dynamically ?

If so how are you managing its viewstate - you need to use something like Denis Bauers's
Dynamic Placeholder code if you want the state of the captcha field to be tracked properly

http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx

Westa

 
New Post
5/28/2008 11:21 AM
 

Wes' option will work, but I had major problems when using Denis Bauers' placeholder in my code.

I have gotten around it by just setting the visbility of the Captcha, it isn't the most elegant, but it is the most functional.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
6/4/2008 11:52 PM
 

Hi guys... Thanks for your input. What exactly do you mean by 'setting the visiblity'?

As far as what fields are dynamic... they are actually all dynamic, but this is the only one where the viewstate is not being processed properly. If I don't enable the viewstate then I have no access to what the actual code should be, and if I do enable to viewstate then after postback if the fields on the page change very much I get an error related to failure to load viewstate. This is the only control I am having this problem with (at this point at least). I might try placing the control in an actual file.ascx (instead of just adding it dynamically) but I am not sure why this would be necessary or if it would work differently.

 

-Chad

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Captcha Web Control - Maintaining ViewStateCaptcha Web Control - Maintaining ViewState


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out