AJAX call Javascript function from Update Panel Postback

G

gabe

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
 
G

Guest

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/archi...quest-client-side-page-life-cycle-events.aspx

HTH
Braulio

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top