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

Shiva_KumarAsked:
Who is Participating?
 
Shiva_KumarAuthor Commented:
Hi,

The problem is fixed.

I was able to fix the problem by disabling the Caching for the module.
By setting the default cache time to -1 i was able to fix the problem.

Thanks
0
 
clinton_cunninghamCommented:
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


0
 
Shiva_KumarAuthor Commented:
Thanks Clinton for the suggestion...

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

Regards
Shiva
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Shiva_KumarAuthor Commented:
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!

0
 
Shiva_KumarAuthor Commented:
Any update?
0
 
clinton_cunninghamCommented:
Not sure about the error,

try returning to your original solution, and then trying this,

re: Scriptmanager, that should register the script fine - if the "If DotNetNuke.Framework.AJAX.IsInstalled" evaluates to true - have your debugged and stepped through to make sure it's true?

Also, check your page output - because AJAX is enabled in DNN the framework might already be injecting a script manager for ajax iteself, you can have two script managers on a single page - this could be throwing things off.

So, 1) Make sure "DotNetNuke.Framework.AJAX.IsInstalled" evaluates to true. Then you know its install.
2) disable the Register script line (13)  DotNetNuke.Framework.AJAX.RegisterScriptManager()
totally. and see if it works without dynamically registering it.


0
 
paololabeCommented:
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


0
 
Shiva_KumarAuthor Commented:
Hi paololabe,

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

Thanks
0
 
Shiva_KumarAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.