Hi All,
I have done some programs using UpdatePanel and UpdateProgress controls in VS-2008. All they worked fine. Recently I started using Visual Studio 2012 at home.
The following is the complete program I am doing as a whole. But, I am not getting the messageContacting server... inside UpdateProgress control's ProgressTemplate.
Can anybody please suggest me where I am doing wrong!
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UpdatePanelWithUpdateProgress.aspx.cs" Inherits="CSHWEB.UpdatePanelWithUpdateProgress" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title></head><body><form id="form1" runat="server"><div><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager><asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"><ProgressTemplate>
Contacting server...<br /><span id="messageSpan"></span></ProgressTemplate></asp:UpdateProgress><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:GridView ID="GridView1" runat="server"></asp:GridView></ContentTemplate></asp:UpdatePanel></div></form></body></html>Code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace CSHWEB
{
public partial class UpdatePanelWithUpdateProgress : System.Web.UI.Page
{
SqlConnection objConn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(4000);
SqlCommand objCmd = new SqlCommand("usp_GetEmployeesAll", objConn);
objCmd.CommandType = System.Data.CommandType.StoredProcedure;
objConn.Open();
GridView1.DataSource = objCmd.ExecuteReader();
GridView1.DataBind();
objConn.Close();
}
}
}