Solved

Ajax updatepanel doing full postback of page

Posted on 2009-03-31
7
618 Views
Last Modified: 2012-05-06
recently I was working on a project. Built with Ajax and .Net 3.5. Well come to find out that networksolutions doesn't support .net 3.5 only .net 2.0. So I had to get the older version of the ajaxcontroltoolkit.dll (Version 1.0.20229).

Well ever since then, when i use the updatepanel in my code, it refreshes the whole page.

So I went in and created a simple page with 2 clocks. One inside the updatepanel and one outside the update panel with a  button. Everything I click the button, the whole page is updating both times.

Anyone seen this before?
0
Comment
Question by:kblackwel
  • 4
  • 2
7 Comments
 
LVL 16

Expert Comment

by:burakiewicz
ID: 24032904
is the button inside of an updatepanel
0
 

Author Comment

by:kblackwel
ID: 24033008
Yes
0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 24033024
if you dont specify UpdateMode="Conditional" then then the panels will always update with any update.
try adding
UpdateMode="Conditional" ChildrenAsTrigger="true"
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 16

Expert Comment

by:burakiewicz
ID: 24033032
or you can use UpdateMode="Conditional"
and assign the buttons as asyncpostbacktriggers
0
 

Author Comment

by:kblackwel
ID: 24035124
Dude @##$%

I have no idea what the probelm is. I have tried both of your recommendations. Neither worked.

SO I started from scratch.

I downloaded the ajaxtoolkit for .net 2.0 and .net 3.5

Using the code below, I created a web site.

On the ajax toolkit version 2.0, the whole page is getting updated.

Version 3.5, it works right.

I have no idea what I'm doing wrong.


<-- Working version for 3.5 -->
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Button ID="Button1" runat="server" Text="Button" />
        
            &nbsp;The time is:
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        
        </ContentTemplate>
        </asp:UpdatePanel>
        </div>
    <p>
        The time is:<% Label2.Text = Date.Now.ToString%>
        <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
        
        :
                
    </p>
    
    </form>
</body>
</html>
 
<-- Not working version with ajax for net 2.0 -->
 
<%@ Page Language="VB" AutoEventWireup="True" CodeFile="Default.aspx.vb" Inherits="_Default" %>
 
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
 
            <ContentTemplate>
                <asp:Button ID="Button1" runat="server" Text="Button" />                 
                &nbsp;The time is
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            </ContentTemplate>  
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
    <p>
        The time is:<% Label2.Text = Date.Now.ToString%>
        <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
        
    </p>
 
    </form>
</body>
</html>

Open in new window

0
 
LVL 3

Accepted Solution

by:
dipakdave1983 earned 500 total points
ID: 24036090
apart from all suggested solution like button must be inside update panel and <asynchronousTrigger>

you must ensure proper .net assembly references are referenced into web.config .



- can see iven if u started from scratch its not working so i suspect more about web.config...


also,your target label also must be inside your updatepanel.
0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 24039006
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Code Manager | Snippits 2 37
Change to file doesn't show up 16 54
JQuery Search Filter 2 37
How can I do Unit Testing with Session ? 1 13
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 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