Hi
I'm having problems using the updateprogress control in ASP.NET. I've successfully created a small project using this control successfully, but when I created a simple .aspx page in my solution using the same code then it doesn't work. There is a mismatch in the rendered HTML code, where it doesn't work it is missing sections, e.g.
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTQ0OTI0ODUwMg9kFgICAw9kFgICBQ9kFgJmD2QWAgIDDw8WAh4EVGV4dAVqMTc6Mjc6MzA8YnIgLz4xNzoyNzozMDxiciAvPjE3OjI3OjMwPGJyIC8+MTc6Mjc6MzA8YnIgLz4xNzoyNzozMDxiciAvPjE3OjI3OjMwPGJyIC8+MTc6Mjc6MzA8YnIgLz4xNzoyNzozMGRkZIkvHCekERlfS9y4PA2asxGaEowE" />
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="/WebResource.axd?d=xwJ8mgqm3wQN2acMjQykvA2&t=633941258702151333" type="text/javascript"></script>
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], [], [], 90);
Has anyone had this problem ? Maybe I am missing a javascript reference ?
Here is the html setting for the page
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="UpdateProgressTest._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>Update Progress</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
Some page content<br/>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="true" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate> Processing… </ProgressTemplate>
</asp:UpdateProgress>
More page content<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate> <div style="border-style:solid;background-color:gray;">
<asp:Button ID="Button1" runat="server" Text="Update"/><br/><br/>
<asp:Label runat="server" ID="time1"></asp:Label><br/></div><br/>
</ContentTemplate>
</asp:UpdatePanel><br/>
</div>
</form>
</body>
</html>
Here is the C# code behind section for the same page:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace UpdateProgressTest
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(4000);
// base.OnLoad(e);
string theTime = DateTime.Now.ToLongTimeString();
for (int i = 0; i < 3; i++)
{
theTime += "<br />" + theTime;
}
time1.Text = theTime;
}
}
}
As I said, this code works fine in my test project, but fails when I use it in my solution (I created a new page, just to be sure my other controls were not interfering with the callback ajax mechanism)
Can anyone help ?