AJAX updatepanel not preventing entire page postback?
-
Months ago in VS 2005 I did some demo projects with AJAX and everything worked. I'm now using VS 2008 with the built in AJAX tools and I am running into some difficulty where the entire page is refreshing even though I have my event inside an update panel. Here is my aspx page:
<form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <br /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> <br /> <asp:Button ID="Button1" runat="server" Text="Button" /> </ContentTemplate> </asp:UpdatePanel> </div> </form>
Here is the page load code behind set to refresh the time in both labels.protected void Page_Load(object sender, EventArgs e) { Label1.Text = System.DateTime.Now.ToString(); Label2.Text = System.DateTime.Now.ToString(); }
The problem I am having is that even though the button click event occurs inside the update panel the entire web page is posting back. Both labels refresh with the current datetime. Any ideas? -
Months ago in VS 2005 I did some demo projects with AJAX and everything worked. I'm now using VS 2008 with the built in AJAX tools and I am running into some difficulty where the entire page is refreshing even though I have my event inside an update panel. Here is my aspx page:
<form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <br /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> <br /> <asp:Button ID="Button1" runat="server" Text="Button" /> </ContentTemplate> </asp:UpdatePanel> </div> </form>
Here is the page load code behind set to refresh the time in both labels.protected void Page_Load(object sender, EventArgs e) { Label1.Text = System.DateTime.Now.ToString(); Label2.Text = System.DateTime.Now.ToString(); }
The problem I am having is that even though the button click event occurs inside the update panel the entire web page is posting back. Both labels refresh with the current datetime. Any ideas?I've read threads regarding the xhtmlconformance, but my webhost says the machine.config has it set to Transitional already and I've even added the Transitional line to the project's web.config so I'm still baffled. The same code works locally on the machine, but not on the production site.
-
I've read threads regarding the xhtmlconformance, but my webhost says the machine.config has it set to Transitional already and I've even added the Transitional line to the project's web.config so I'm still baffled. The same code works locally on the machine, but not on the production site.
Just Remove the tag from web.config file I think It will Work For You Ragards, Sukku Reddy.
-
Just Remove the tag from web.config file I think It will Work For You Ragards, Sukku Reddy.
remove xhtml tag from web.config file