0
votes

I am new in dotnetnuke module development.

Settings: dotnetnuke 7 + christoc module, telerik ajax ui conrols: Q2 release 2. I have registered a usercontrol Patientupdate.ascx in DNN. Inside it I have several controls i.e. a radgrid (ResultaatGrid) and a radwindow, also as a user control (but not registered in DNN) named COVUserControl. The radwindow is called inside a radgrid in formedit mode when a button is click.

a snippet of the code for the radwindow(inside the patientupdate.ascx)

In the radwindow I have put the usercontrol (COVUserControl) and inside the user control I have defined a radgrid.

<telerik:RadWindow ID="COVWindow" Title="Editing record" Width="270"
        Height="540" VisibleOnPageLoad="false" Behaviors="Resize, Minimize, Close, Pin, Maximize, Move"
        Left="610" EnableShadow="true" runat="server" OnClientClose="refreshGrid" Modal="true">
    <ContentTemplate>
         <asp:Panel ID="Panel1" runat="server">
                <COVUC:COVUserControl runat="server" ID="COVUCID"/>
        </asp:Panel>
    </ContentTemplate>
</telerik:RadWindow>

In the edit template I have a button named (in the patientupdate.ascx) and in the code behind of the patientupdate.ascx.cs

in the ResultaatGrid_Itemcommand I have the following code:

     protected void ResultaatGrid_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "COV")
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;

            string pCperID = editedItem.GetDataKeyValue("cpersoon_id").ToString();
            COVWindow.Width = 500;
            COVWindow.Height = 250;
            COVUserControl COVUC1 = COVWindow.ContentContainer.FindControl("COVUCID") as COVUserControl;
            COVUC1.cPersoonID = pCperID;
            RadGrid COVGrid = COVUC1.FindControl("COVGrid") as RadGrid;
            string script = "function f(){$find(\"" + COVWindow.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
            COVGrid.Rebind();
        }

    }

The problem is that the radwindow does not pop-up. (I have check the pop-up in host -> extension-> and check allow pop-ups for the module).

When debugging (attach) I see Covgrid.rebind is fired because it fires the radgrid need datasource of the grid inside the COVUserControl.

The same code works, the radwindow pop-up, when NOT a dotnetnuke module. (just plain patientupdate.aspx).

I think that the following code lines does not fire:

string script = "function f(){$find(\"" + COVWindow.ClientID + "\").show();     
Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
2

2 Answers

0
votes

Try

ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "key", script, true);

I have had some issues when registering scripts from user controls or custom controls. Registering them through the Page object has not failed me so far.

0
votes

I was going the same route as you with the radwindow in DNN and the short answer is don't use Sys.Application.add_load when in DNN, it doesn't like it at all. Has to do with the component is not loaded via Sys.Application.add_init().
Go with pageLoad() instead.