 |
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

September 29th, 2007, 12:01 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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/
|
|

October 1st, 2007, 06:22 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2006
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Hi,
did you check for a postback in the page_load ?
koen
|
|

October 1st, 2007, 11:55 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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/
|
|

October 2nd, 2007, 03:06 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
|
|
peter - you're like a boston terrier!! ynufff - problem gone.
keep it up.
jimi
http://www.originaltalent.com
|
|

October 4th, 2007, 04:21 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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/
|
|

October 4th, 2007, 10:26 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 4th, 2007, 02:13 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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/
|
|

October 5th, 2007, 05:21 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
|
|
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
|
|

October 11th, 2007, 01:52 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 11th, 2007, 02:07 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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/
|
|
 |