Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   AJAX call Javascript function from Update Panel Postback (http://www.velocityreviews.com/forums/t525973-ajax-call-javascript-function-from-update-panel-postback.html)

gabe 07-31-2007 04:20 PM

AJAX call Javascript function from Update Panel Postback
 
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("txtRecipientAm ount"),
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("txtRecipientAm ount"),
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


=?Utf-8?B?QnJhdWxpbyBEaWV6?= 07-31-2007 08:40 PM

RE: AJAX call Javascript function from Update Panel Postback
 
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.ToSt ring());%>')
{

$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/archiv...le-events.aspx

HTH
Braulio

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




"gabe" wrote:

> 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("txtRecipientAm ount"),
> 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("txtRecipientAm ount"),
> 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
>
>



All times are GMT. The time now is 01:40 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.