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

3 posts, 1 answers
  1. Boris
    Boris avatar
    289 posts
    Member since:
    Oct 2012

    Posted 14 Feb 2013 Link to this post

    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:
    and here:

    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.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move +
                              Telerik.Web.UI.WindowBehaviors.Close +

    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.  

  2. Answer
    Marin Bratanov
    Marin Bratanov avatar
    3899 posts

    Posted 15 Feb 2013 Link to this post

    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.

    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.
  3. Boris
    Boris avatar
    289 posts
    Member since:
    Oct 2012

    Posted 18 Feb 2013 Link to this post

    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.  :-)
Back to Top