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

RadWindow doesn't show when RowDblClick from dynamically loaded usercontrol

3 Answers 116 Views
Window
This is a migrated thread and some comments may be shown as answers.
Felix Ruben Melendez Batres
Top achievements
Rank 1
Felix Ruben Melendez Batres asked on 21 Mar 2011, 06:42 AM
Hi there,

I'm facing the following problem:

First I had a web page that consisted of a RadTabStrip. When you clicked on any of its tabs, a RadGrid would be shown (related to its tab). There was one Radgrid in particular that when you double clicked on a row a RadWindow would show and render a PDF as its contents. As anyone might imagine for this I had to set the RadGrid's OnRowDblClick ClientSetting-ClientEvents to a javascript function.
<ClientSettings...
   <ClientEvents OnRowDblClick="RowDblClickAC" />

and the function:
function RowDblClickAC(sender, eventArgs) {
                var oWnd = window.radopen("../Catalogos/CatContent.aspx?" +
                    "NoCredito=" + eventArgs.getDataKeyValue("ID") +
                    "&FechaRegistro=" + eventArgs.getDataKeyValue("DateTrans"),
                    "uld");
                oWnd.setSize(800, 500);
                oWnd.center();
                oWnd.set_modal(true);
                oWnd.set_title = "PDF Content";
            }

and I also had the RadWindowManager code:
<telerik:RadWindowManager ID="rwm" runat="server" Skin="Outlook">
        <Windows>
            <telerik:RadWindow ID="uld" runat="server"
                AutoSize="true" VisibleTitlebar="true"
                VisibleStatusbar="false"
                ReloadOnShow="true" Modal="true" ShowContentDuringLoad="false"         
                Skin="Outlook" />
        </Windows>
    </telerik:RadWindowManager>

As anyone can see this code, everything worked OK as soon as the controls were declared declaratively. For performance reasons, I had to re-create the webpage by now loading dynamically each RadGrid. Now when I want to double click on a row, the RadWindow pops up but it stays there "forever" (with a circular loading panel) but without presenting the PDF. As I just mentioned, before everything worked OK.

Please, can someone shed some light on this?

Felix

3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 22 Mar 2011, 04:53 PM
Hi Felix,

Basically, the code you have provided should work in the same manner no matter you have added the grid dynamically or declaratively. However, the result you describe can be cause by a javascript error - please carefully examine your code for such - e.g set_title is a method and it should be used as

oWnd.set_title("PDF Content")

instead of

oWnd.set_title = "PDF Content"

This particular incorrect line will not cause a javascript error because of the way javascript works. However, similar incorrect syntax could cause a problem.

At last, if you cannot find the problem or you see the js error but you need further assistance, please send us a live url along with detailed reproduction steps and explanations and we will examine it for you.


Greetings,
Svetlina
the Telerik team
0
Felix Ruben Melendez Batres
Top achievements
Rank 1
answered on 22 Mar 2011, 07:35 PM
Svetlina,

Thanks for your support. I updated my code with your suggestion but it still does not work. I'd like to explain a little bit more on this issue.

I have a web page that contains only code-behind (it has no visual content) that is in charge of converting HTML content to PDF. As you might imagine I used RadEditor to save to the database the HTML code. Let's call this page LetterConverterToPDF.aspx.

On the other hand, I have a web page that consists of loaded dynamically web user controls. Let's call this web page DynamicControls.aspx One of these web user controls in particular has a RadGrid control which displays rows of letters content (letters that are to be sent to customers). When I mean letters I'm talking about the content of the letters. For example certain content for customers who have debts. Back to the problem..., when a user double clicks on a row, I execute a javascript function to load a RadWindow which makes reference to the aforementioned web page (the parragraph above - LetterConverterToPDF.aspx), which converts the HTML code (saved by the RadEditor) to PDF, which finally displays the content.

I have also another web page for querying the history of all these letters (by Date, by Customer, etc). Let's call this webpage LetterQuerying.aspx And also, from this web page I re-use the LetterConverterToPDF.aspx so that once you find a certain letter, you also double click on a row and then it displays the PDF inside a RadWindow.

Now... my question is: Why does the LetterConverterToPDF.aspx which uses a RadWindow to show the PDF, work great! just from LetterQuerying.aspx and not from DynamicControls.aspx when practically I'm using the same logic? And also I've checked the code on both web pages and the only difference as I stated on previous post is that this time, the RadGrid from where the double click gets fired, is loaded dynamically. As you noted, the javascript logic is just the same. I have not changed it.

Do you have any ideas why this is happening? Thanks again for your help,

Felix
0
Svetlina Anati
Telerik team
answered on 24 Mar 2011, 03:25 PM
Hello Felix,

Indeed, what you report seems to be strange because the logic should be the same.

What I can assume is the following:

1) Are you executing some script from the server? If so, a possible reason for the problem is that you are executing it too early in the client-side lifecycle of the page when the ajax objects are still not created.

2) Are you by any chance using hidden containers? It is possible that you add dynamically controls to a hidden container and they cannot calculate their bounds since they are initially hidden.

3) Make sure that you create the controls when suitable, e.g no later then OnInit event

4) At last, would you please remove any ajaxifications for test purposes and run the page again? If this works, reexamine the ajax settings you have used.

Let me know what are the results of the suggestions above and if possible - send me either a working reproduction demo or at least a live url and I will do my best to help.

Regards,
Svetlina
the Telerik team
Tags
Window
Asked by
Felix Ruben Melendez Batres
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Felix Ruben Melendez Batres
Top achievements
Rank 1
Share this question
or