I'm having some problems with the server side and client events on my web form. What I found is that client side events fire before server events. This is problematic for me because I have a jquery function that clears the form when it's submitted but the form is cleared before my server side event has fired so I wind up with a blank record in my database.

How can I get around this problme?

The other question I have is whether there are any good resources or books that go in depth on the interaction between ASP.NET and client side scripting that would cover issues such as what I'm experiencing?

Thanks

Client side actions happen first because they occur in the browser and don't require the post back. Why don't you simply remove the part of the script that clears the form?

Removing the script would solve my problem but I need to clear out the form after the data is submitted. I realize the form can be cleared using server side code but I though the whole purpose behind client side code is to avoid a round trip to the server, unless I'm horribly mistaken about that I would prefer to clear the form from the client side.

Thanks

But you are doing server side processing, thats the problem you are having. So you won't be triggering a round trip just to clear the form because you can just add that to whatever else you are doing server side. No extra trip required.

Hadn't really though of it that way but makes perfect sense.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.