Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 29th, 2007, 12:01 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Copenhagen, , Denmark.
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
Default AJAX + TBH?

Hi :)

Tried creating my very first AJAX ASP.NET usercontrol and hook it into the existing site today. I started off with (what I thought was) a real simple control. So I created a new user control (after having added all kinds of weird stuff to my web.config in order to configure Ajax), dragged a ScriptManager, an UpdatePanel, and a timer onto it, followed by a label.

I set the timerinterval to 1000 (1 second. I know this creates additional bandwith. However, for now that's fine with me), and in the codebehind on the Tick event of the timer, I update the label to reflect the current UTC time.

Easy peasy.I'm feeling like the MacDaddy of the AJAX already.

Shock, horror though when I registered the event on my page, put it where I want it (which happens to be a container), and then run the site.Nasty evil errormessages! Curse them!

"Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. "

I have done some reading up, and I'm quite sure what happens. I also understand why it happens, and the reasoning behind wanting validation for postbacks. I tried using the following snippet of code, posted inside my usercontrol:

protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
this.Page.ClientScript.RegisterForEventValidation( this.uniqueID);
}
However, then my page loads, but no control. Nada. I also tried the OnInit event, but that doesn't help either. enableEventValidation=true is just not an option as far as I'm concerned.

Can anyone tell me what I might be doing wrong, please? It's such a simple control, I must be overlooking something :(

I tried setting the enableEventValidation in the master page, but no result. I also have this question on the asp.net forums, but have been unable to get help there so far.

I'd love to be able to write a bunch of AJAX user controls I can then hook up as WebParts, but hopefully without this much hassle :(

Thanks, Peter

http://entropia-online.blogspot.com/
__________________
http://entropia-online.blogspot.com/
Reply With Quote
  #2 (permalink)  
Old October 1st, 2007, 06:22 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: , , .
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to vantoko
Default

Hi,

did you check for a postback in the page_load ?

koen

Reply With Quote
  #3 (permalink)  
Old October 1st, 2007, 11:55 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Copenhagen, , Denmark.
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
Default

I spent some time today browsing other threads on asp.net, and tried out a bunch of ideas from there.

The one suggestion that made the difference was someone suggesting to look for <form> tags.

Sure enough, within my masterpage, I had a form tag, and within that, a paypal donate button.

I played around with things a little, and by moving the paypal button outside the original formtag, I now am able to get things working, without requiring any nasty prerender or registerforeventsalidation crap.

:)

Nice AJAX *pet pet*



http://entropia-online.blogspot.com/
Reply With Quote
  #4 (permalink)  
Old October 2nd, 2007, 03:06 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 10 Times in 9 Posts
Default

peter - you're like a boston terrier!! ynufff - problem gone.

keep it up.

jimi

http://www.originaltalent.com
Reply With Quote
  #5 (permalink)  
Old October 4th, 2007, 04:21 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Copenhagen, , Denmark.
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
Default

Arf!!!

Thanks, Jim :)

However, I ran into a different problem now. After about 10 minutes of leaving my page open, I was getting pop-ups complaining about something (don't exactly recall the message, and I'm at work now). I traced the error back to what seems to be an auto-logoff happening after some time.

In my code, I had added a Response.Redirect to Default by implementing an event in the LoginStatus control. I changed that to use an internal option of the control (LogoutPageUrl), but receive the error again.

My guess is that TBH has a setting somewhere regardng a Session timing out. I did a quick search on Session in the code, but came up blank. Does anyone remember anything about this, and where it was set?

(I also ran into some Session trouble with your logout tip, Jim. For now, I have disabled it, but I'd really like to see that fucntionality back in my website again).

My guess is that the session timing out is somehow interfering with the AJAX postbacks, and I'd love to bite into it, but have no idea where to start :)

Thanks again :)

Peter

http://entropia-online.blogspot.com/
Reply With Quote
  #6 (permalink)  
Old October 4th, 2007, 10:26 AM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Peter, from where are you run your site?

From IIS or from vs console?

I get this problem too... I don't use ajax but i loose my login (besides i check "remeber" checkbox) after 10 minutes from last activity...

I think that's because I'm not running the site from IIS
Reply With Quote
  #7 (permalink)  
Old October 4th, 2007, 02:13 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Copenhagen, , Denmark.
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
Default

Either, or, Maxxim.

I have a temporary site up at www.entropiaonline.com, which is running at the provider. I do most of my testing with local pages, running against the database at the provider.

However, in both situations, the error comes up.

The error I got yesterday was something to do with Sys.Webforms.PageRequestmanagerparsererrorexceptio n. I tried a few things, but so far to no avail.

For the moment, I've decided just to remove my control again. I have already spent too much time on the issue, and frankly, the site should have been up and in beta test last weekend. I'll try and finish up two other things I wanted to implement, then get my beta peeps in, and in the meantime, I might try and work on the AJAX errors.

I'd really want to solve the AJAX errors, though, as they'd allow me to add some cool content the users will love. So here's keeping my fingers crossed for finding an easy solution :)

One thing I did notice. I noticed the error spawning far far faster on a few pages. I haven't really put my finger on it yet, nor have I done extensive testing, but it seems as if the FCKControl might be the common factor. I'll have to look into that more before jumping to conclusions though.

Cheers,

Peter

http://entropia-online.blogspot.com/
Reply With Quote
  #8 (permalink)  
Old October 5th, 2007, 05:21 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 10 Times in 9 Posts
Default

Peter, one thing to check on compilation of your 'remote' site is that you have the <compilation debug="false"> in web.config set to false, this makes a HUGE difference to loading and performance. i'm sure you knew this but just in case!!

jimi

http://www.originaltalent.com
Reply With Quote
  #9 (permalink)  
Old October 11th, 2007, 01:52 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Peter, how did you implement AJAX in TBH ?

I never used AJAX before. I'm seeing a videoTutorial about "Ajax Autocompletation" and I already Installed my AjaxKitV1...

If start a new website from zero I can use Ajax but how can I implement AJAX in pre-releases like TBH?

I saw some docs about converting ATLAS Projects to AJAX! But TBh isn't an Atlas Project or is?

Thanks

Reply With Quote
  #10 (permalink)  
Old October 11th, 2007, 02:07 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Copenhagen, , Denmark.
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
Default

Maxxim,

I got the kit(s) from ASP.NET. There's a walkthrough there, which lists bits and pieces you have to copy into your web.config in order to succesfully implement AJAX.

That's pretty much it, really.

If you manage to build a control, I'd be interested in hearing if, when you are logged in as a user and do nothing for about 10 minutes, you also get errors and popups...

Cheers,

Peter

http://entropia-online.blogspot.com/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Atlas/AJAX - anyone have success using with TBH? deasoft BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 February 17th, 2009 12:24 AM
Adding AJAX functionality to TBH gujju BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 5th, 2008 12:35 AM
AJAX-TBH FT BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 17 August 6th, 2007 04:11 AM
Recommend an AJAX IDE - JoyiStar AJAX WebShop. kingstar Ajax 4 December 15th, 2006 04:12 AM
new Ajax article: Creating an Ajax Search Widget jminatel Ajax 0 May 11th, 2006 02:50 PM



All times are GMT -4. The time now is 07:56 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.