Steve Krile
asked on
Button not performing Asynch Postback
Full of frustration here. I have a very simple page that works by itself. But, when I add it to another project, it *works*, but instead of doing the asynch postback, I'm getting a full post back. I don't even know how to troubleshoot this. The code is good, so something about my configurartion must be wrong...but what?
I've tested a lot of different things...for instance, I've tried putting a GridView in the update panel and guess what....the Header Sort works asynchronosly. On the same page, the Button does a full post back. Sigh. Where should I start digging to find the culprit?
Here is the code -
---------.net page-------
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="test.aspx.vb" Inherits="HSE.test" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server" UpdateMode="conditional" ID="updatePanel">
<ContentTemplate>
<asp:Label runat='server' ID="label1" />
<asp:Button runat="server" ID="button1" Text="update" OnClick="button1_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="button1" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
-------code behind-----
Public Partial Class test
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
label1.Text = Now.ToString()
End Sub
End Class
I've tested a lot of different things...for instance, I've tried putting a GridView in the update panel and guess what....the Header Sort works asynchronosly. On the same page, the Button does a full post back. Sigh. Where should I start digging to find the culprit?
Here is the code -
---------.net page-------
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="test.aspx.vb" Inherits="HSE.test" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server" UpdateMode="conditional" ID="updatePanel">
<ContentTemplate>
<asp:Label runat='server' ID="label1" />
<asp:Button runat="server" ID="button1" Text="update" OnClick="button1_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="button1" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
-------code behind-----
Public Partial Class test
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
label1.Text = Now.ToString()
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<input type="submit" name="button1" value="update" id="button1" />
And here is what one of the heads of the gridview looks like:
<a onclick="javascript:__gvPl
Looks like Ajax is doing the right thing with the grid headers, but not with the button....weird.