Link to home
Start Free TrialLog in
Avatar of Shiva_Kumar
Shiva_Kumar

asked on

DotnetNuke AJAX module refreshing the whole page

Hi,

I am new to dotnetnuke and module creation.  I have created a sample AJAX enabled module which shows the time on a button click.

The problem i am facing here is it refreshes the whole page instead of refreshing the update panel.

I am running dotnetnuke 4.9 with visual studio 2005,  ajax 1.0  and ajax control toolkit ver 1.0.20229.0.

Please find the my aspx and code behind page and let me know what am i doing wrong here.
//===================================test.ascx.vb======================================
Imports DotNetNuke
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Imports DotNetNuke.Security.PortalSecurity
 
Partial Class DesktopModules_Test_Test
    Inherits DotNetNuke.Entities.Modules.PortalModuleBase
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If DotNetNuke.Framework.AJAX.IsInstalled Then
            DotNetNuke.Framework.AJAX.RegisterScriptManager()
        End If
    End Sub
 
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = Date.Now
    End Sub
 
End Class
 
==========================================test.ascx===========================
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Test.ascx.vb" Inherits="DesktopModules_Test_Test" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<br />
&nbsp;<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:Label ID="Label1" runat="server"></asp:Label>
        <br />
        <br />
    <asp:Button ID="Button1" runat="server" Text="Button" />
    </ContentTemplate>
    </asp:UpdatePanel>
&nbsp;

Open in new window

Avatar of clinton_cunningham
clinton_cunningham
Flag of Australia image

try setting the updatemode to conditional -

<asp:UpdatePanel ID="UpdatePanel1" runat="server"
 UpdateMode="Conditional">

and then add the button attribute autopostback -
<asp:Button ID="Button1" runat="server" Text="Button" autopostback="true" />

Your code should theoretically work though, but these attributes can help in forcing it to. Also make sure the ajax scriptmanager is being registered properly on the pageload (check the page output source) and also in DotNetNuke, there is an setting to add 'partial postbacks' / ajax to a page. When your creating a control to add your new page, go through the settings of it and you should find a checkbox for it.

Let me know what version you are running of DNN - i will try write down instructions for enabling the ajax mode via the control settings.

also try: http://www.arrownuke.com/Blog/tabid/295/EntryID/25/Default.aspx


Avatar of Shiva_Kumar
Shiva_Kumar

ASKER

Thanks Clinton for the suggestion...

I will try thist out tomorrow and will get back to you :)

Regards
Shiva
Hi Clinton,

I have tried your suggestion but it didn't work and its still refreshing the page without showing the time and i am also getting this error message:

"Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request."

Please look at the code test.ascx.vb where i am registering the script manager.

The setting which you were talking about to have the ajax functionality added is the "Partial rendering" which is also enabled to the module.  Let me know if there is some other settings which needs to chaged.

I am using the dotnetnuke version 4.9

Help!

Any update?
SOLUTION
Avatar of clinton_cunningham
clinton_cunningham
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have to set the properties:
Supports Partial Rendering?   = True

you can do this going in ModuleDefinions panel, edit the module settings, in the section listing Controls (bottom of the page) choose to edit option for your view control (tipically the first) and check the option Supports Partial Rendering? , save and retry

Paolo


Hi paololabe,

Please see my comments above... i have allready enabled the Partial rendering.

Thanks
Hi Clinton,

Here's the analysis:

1. "DotNetNuke.Framework.AJAX.IsInstalled" is evaluating to true
2. removed the line "DotNetNuke.Framework.AJAX.RegisterScriptManager()",  But the problem still persists.  Dunnow what and where i am going wrong here.

Any other suggestions?

Thanks
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial