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

Inconsistent (?) behavior when calling a RadWindow with different client methods.

2 Answers 38 Views
Window
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 14 Feb 2013, 03:12 PM
I've got a web page in my system that pops up when I double-click on a RadGrid row.   This has been working fine.

This is based mainly on these examples:  
http://www.telerik.com/community/forums/aspnet-ajax/window/customization-of-radwindow-through-clientside-javascript.aspx
and here:
http://demos.telerik.com/aspnet-ajax/window/examples/radopen/defaultvb.aspx

The JavaScript is called by the RadGrid in the client events, OnRowDblClick.  

Now, what I'd like is to have a similar screen called by a button in the grid row.  (For test purposes I am calling the same screen and JavaScript function.)  To this end I have added a GridButtonColumn, ImageButton type, to the grid.  In the C# code, in the ItemDataBound event, I have added the following code.  
if (e.Item is GridDataItem)
 {
    GridDataItem item = (GridDataItem)e.Item;
    ((ImageButton)item["PrintDoc"].Controls[0]).Attributes.Add("onclick", "printDoc(this," + item["Id"].Text + ");");                              
 } 

The JavaScript code is as follows:

  function printDoc(sender, Id) {
       var oWnd = window.radopen("PrintDoc.aspx?Id=" + Id, "Print Doc");
       oWnd.SetWidth(600);
       oWnd.SetHeight(400);
       oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move +
                          Telerik.Web.UI.WindowBehaviors.Close +
                          Telerik.Web.UI.WindowBehaviors.Resize); 
       oWnd.show();
 }

The Javascript code is getting called and receiving the correct data.  The problem is that when called from the button, the window is just flickering on the screen for an instant before vanishing.  

Suggestions?

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 15 Feb 2013, 08:32 AM
Hello Boris,

A button, by default, performs a postback, which would dispose (and effectively close) the RadWindow we just opened. You need to prevent this postback.

If you are using a standard ASP button you need to return false and if you are using a RadButton you need to set its AutoPostBack property to false.


Regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Boris
Top achievements
Rank 1
answered on 18 Feb 2013, 02:42 PM
I'll keep that in mind.  

(But now they're changed the specs again and I have no need to do this at this time.  :-)
Tags
Window
Asked by
Boris
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Boris
Top achievements
Rank 1
Share this question
or