Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > AJAX call Javascript function from Update Panel Postback

Reply
Thread Tools

AJAX call Javascript function from Update Panel Postback

 
 
gabe
Guest
Posts: n/a
 
      07-31-2007
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QnJhdWxpbyBEaWV6?=
Guest
Posts: n/a
 
      07-31-2007
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
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Layout within Ajax Update Panel in Visual Studio DanWeaver ASP .Net 2 02-22-2007 09:57 PM
ASP.NET Ajax Update Panel in ContentPlaceHolder =?Utf-8?B?Qw==?= ASP .Net 0 02-12-2007 04:26 PM
AJAX Update Panel w I.E.7 Problem GaryDean ASP .Net 10 12-12-2006 06:07 AM
ajax update panel trigger =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 2 10-07-2006 01:49 AM
datalist and ajax update panel =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 2 10-02-2006 07:31 PM



Advertisments