Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 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
 
Old May 30th, 2008, 06:11 AM
Authorized User
 
Join Date: May 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kalyanykk
Default avoid postback using ajax in javascript

Hi I am refreshing a web page
in javascript like "document.form.submit()"
 when ever i modify the text in a text box.

I am using aspx text box where i have called onblur event in code behind using the syntax textbox.attibutes.add("onblur","fnRefresh()") of this text box in javascript

so when text is changed i am calling javascript function fnRefresh().
now the thing is when this javascript is called i will put some data in another text box like:

function fnRefresh()
{
document.getElementByID("textbox2").value="Text changed in first text box"
document.form.submit()
}

Though i am using ajax controls like scriptmanager & update panel, when my page is getting refreshed, the entire page is loading everytime when the text in first text box is changed.

my requirement is when onblur event fires for first textbox, data should be updated in second text box without loading the entire page.

plz suggest me how would i go about..


 
Old May 30th, 2008, 08:16 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What's the purpose of the form submit? You are already updating the textbox in the javascript. I don't see how AJAX comes into play with this at all. Just delete the second line of your fnRefresh function and it won't submit the form, thus not causing a complete page postback.

If you are performing additional work on server side events of the textbox please describe them further.

-Peter
compiledthoughts.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoid postback when a ComboBox is clicked Kika Other Programming Languages 0 January 21st, 2008 03:08 PM
Ajax and javascript loading pppswing Ajax 0 September 21st, 2006 01:27 AM
postback issue with drop downlists with javascript emachines Javascript 3 January 24th, 2005 06:54 AM
postback issue with drop downlists with javascript emachines Javascript How-To 1 January 6th, 2005 01:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.