This is a migrated thread and some comments may be shown as answers.

OnClose Event For PopUp Template?

4 Answers 350 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeremy Yoder
Top achievements
Rank 1
Jeremy Yoder asked on 17 Nov 2010, 04:59 PM

In my grid, I have EditMode="PopUp" and EditFormType="Template". Works great, but I'd like to call a javascript function after the popup has saved/close and rebound/refreshed the grid with the new or edited row. Ideally, I'd like to assign it programmatically like I do with window popups via the add_close event method, but I'll take what I can get. Is there a way to do this?

4 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 22 Nov 2010, 05:01 PM
Hello Jeremy,

I am afraid there is no special event fired when you close the popup edit form. To implement the desired functionality, you can use RadWindow for editing RadGrid records as demonstrated here.

I hope this helps.

Sincerely yours,
Mira
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Jeremy Yoder
Top achievements
Rank 1
answered on 23 Nov 2010, 03:35 PM

I've coded a lot around the edit form, so it wouldn't be my first choice to switch to RadWindow. However, in the ItemDataBound, I found how I could reference the Panel that is the edit form (via .Parent) and then tried...

pnl.Attributes("onclick") = "alert('Panel clicked');"

It works for the Panel's onclick event, but I've not found an attribute for Panel such as onClose or onDisposed. Do you know if the panel itself has any attribute I could tie into that would do the trick?

0
Mira
Telerik team
answered on 25 Nov 2010, 05:05 PM
Hello Jeremy,

In order to achieve the desired functionality, I suggest that you find the close button of the edit form  and handle its click. This can be done by handling the OnPopUpShowing client event in the following way:
function PopUpShowing(sender, eventArgs) {
 
    var popUp = eventArgs.get_popUp();
    popUp.getElementsByTagName("a")[0].href = "javascript:popUpClosing();" + " " + popUp.getElementsByTagName("a")[0].href.split(':')[1];
 
}
 
function popUpClosing() {
     
    //...
 
}

I hope this helps.

Greetings,
Mira
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Jeremy Yoder
Top achievements
Rank 1
answered on 30 Nov 2010, 03:54 PM

I was only now able to get back to this, and I'm glad to say your code worked great in getting a call to a javascript function from the window close button. I didn't follow it at first, but then I broke it down and saw what you did -- that's some pretty slick coding! :)

However, the grid still doesn't have time to rebind/refresh afterwards, but I'll definitely be using this code for other instances. So I'll revisit the grid rebind timing issue I'm having in a separate post after I dig a bit further into it. Thanks much!
Tags
Grid
Asked by
Jeremy Yoder
Top achievements
Rank 1
Answers by
Mira
Telerik team
Jeremy Yoder
Top achievements
Rank 1
Share this question
or