Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

AJAX call Javascript function from Update Panel Postback

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gabe - 31 Jul 2007 17:20 GMT
How do you call a client side javascript callback method after an
update panel has posted back to the server?

I have two update panels (A + B) with a gridview in each panel.

GridView B has a Trigger to listen when GridView A posts back from a
Select button. This works fine. I can get the Postback from GridView B
and I am able to update formatting of GridView B in it's PreRender
Event.

Gridview B has textboxes open in it's Item Template Mode. I can add an
attribute that to select the data when a user clicks on a textbox.
However, I was not able to call the Microsoft SetFocus event for a
newly added textbox when a new row was added from the RowUpdating
event in GridView A.

(this works fine)
----------------------------------------------------------------------------------------------------------
CType(gridRow.Cells(4).FindControl("txtRecipientAmount"),
TextBox).Attributes.Add("onfocus", "javascript:select();")

If I use the SetFocus method, it will work when the page posts back,
but not the Update Panel.

(this will work with a page post back, but not when the UpdatePanel
posts back)
----------------------------------------------------------------------------------------------------------------
CType(gridRow.Cells(4).FindControl("txtRecipientAmount"),
TextBox).Focus()

What I would like to do is call a javascript method on the client
after UpdatePanel B has been fired. How do I do this?

Thanks for the help,
Gabe
Braulio Diez - 31 Jul 2007 21:40 GMT
Hello,

 There is an event in javascript that is fired when an out of bound call is
made (you can check if the outof bound has been made by an update panel), I'm
using in my pages something like:

   function EndRequest (sender, args) {
      if (postBackElement.id ==
'<%Response.Write(btnSQLServerfilter.ClientID.ToString());%>')
      {              
       
$get('<%Response.Write(UpdateProgressSQL.ClientID.ToString());%>').style.display = "none";    
      }
   }

In my case btnSQLServerFilter is a button that fires my update panel.

More info
http://weblogs.asp.net/wallym/archive/2006/11/01/UpdatePanel-Data-Transfer-and-t
he-beginRequest-and-endRequest-client-side-page-life-cycle-events.aspx


HTH
 Braulio

/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------

> How do you call a client side javascript callback method after an
> update panel has posted back to the server?
[quoted text clipped - 31 lines]
> Thanks for the help,
> Gabe

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.