Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

DotnetNuke AJAX module refreshing the whole page

Posted on 2009-04-21
9
Medium Priority
?
1,567 Views
Last Modified: 2013-11-07
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

0
Comment
Question by:Shiva_Kumar
  • 6
  • 2
9 Comments
 
LVL 2

Expert Comment

by:clinton_cunningham
ID: 24199846
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
 

Author Comment

by:Shiva_Kumar
ID: 24200571
Thanks Clinton for the suggestion...

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

Regards
Shiva
0
 

Author Comment

by:Shiva_Kumar
ID: 24205386
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Shiva_Kumar
ID: 24210824
Any update?
0
 
LVL 2

Assisted Solution

by:clinton_cunningham
clinton_cunningham earned 1200 total points
ID: 24211485
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
 
LVL 8

Expert Comment

by:paololabe
ID: 24212451
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
 

Author Comment

by:Shiva_Kumar
ID: 24215615
Hi paololabe,

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

Thanks
0
 

Author Comment

by:Shiva_Kumar
ID: 24216038
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
 

Accepted Solution

by:
Shiva_Kumar earned 0 total points
ID: 24217408
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question