asp:button OnClick/Postback not working in IE7 & IE8 RRS feed

  • Question

  • User1078276566 posted

     I have a content page that has a form in it. The problem that I am having is that I get no response from the submit button for when clicking on it in IE 7 and 8. I have also siccessfully tested it in Firefox, Chrome and Safari.

    This seems like a fairly common problem but I have yet to find a solution that works. I found some posts that suggested that there might be a problem with the aspnet_client folder so I ran aspnet_regiis -i and restarted IIS. I even when so far as to reinstall the asp.net framework and IIS. No love there.

    I have verified that I have only one form tag in my master page also.

    I also tried messing with the buttons UseSubmitBehavior, but that started up a whole mess of other problems like form field vaules not being posted.

    Maybe there is something simple I've been missing becaue I've been looking at it too long ;) Fresh eyes would be appreciated.

    Here is my master page:

    <%@ Master Language="C#" %>
    <script runat="server">
    <!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">
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
        <asp:ContentPlaceHolder id="head" runat="server">
    <div id="wrapper">
        <form id="form1" runat="server">
            <div id="topBar">
            <div id="header">
            <div id="content">
                <asp:ContentPlaceHolder ID="MainContent" runat="server">

    Here is the Conent page:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" CodeFile="treatmentLocator.aspx.cs" Inherits="treatmentLocator" %>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
        <div class="Form">
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ErrorMessage="Zip code is required." Font-Bold="True" 
                ControlToValidate="txtZipCode" Display="Dynamic"></asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                ErrorMessage="Please enter a valid U.S. zip code." 
                ControlToValidate="txtZipCode" Display="Dynamic" Font-Bold="True" 
            <div class="formRow">
                <label>Please Enter Zip Code:</label><asp:textbox id="txtZipCode" 
                    runat="server" Width="100px" MaxLength="5" Wrap="False" />
            <div class="formRow" dir="ltr">
                <label>Search Radius in Miles:</label><asp:dropdownlist id="ddlRadiusInMiles" runat="server" Width="55px"></asp:dropdownlist>
            <div class="formRow">
                <asp:Button id="btnSearch" runat="server" text="Search" 
                    onclick="btnSearch_Click" UseSubmitBehavior="False" />
        <asp:GridView ID="GridView1" runat="server" Visible="False" CellPadding="4" 
                    ForeColor="#333333" Width="850">
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <asp:BoundField HeaderText="Facility Name" DataField="FacilityName" SortExpression="FacilityName" ItemStyle-Width="200"></asp:BoundField>
                    <asp:TemplateField HeaderText="Address">
                            <%# Eval("Address")%><br />
                            <%# Eval("City") %>, <%# Eval("State") %> <%# Eval("Zip") %>
                    <asp:BoundField HeaderText="Phone" DataField="Phone" SortExpression="Phone"></asp:BoundField>
                    <asp:BoundField HeaderText="Fax" DataField="Fax" SortExpression="Fax"></asp:BoundField>
                    <asp:BoundField HeaderText="Email" DataField="Email" SortExpression="Email"></asp:BoundField>                
                    <asp:TemplateField HeaderText="Miles Distance" SortExpression="MilesDistance">
                            <%# Eval("MilesDistance","{0:f2}")%>
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" 
                    HorizontalAlign="Left" VerticalAlign="Middle" Wrap="False" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    And finally the code behind for the content page:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    public partial class treatmentLocator : Spectrum.pageBase
        protected void Page_Load(object sender, EventArgs e)
            if (!Page.IsPostBack)
        private void MilesLoad()
            ddlRadiusInMiles.Items.Add(new ListItem("50", "50"));
            ddlRadiusInMiles.Items.Add(new ListItem("100", "100"));
            ddlRadiusInMiles.Items.Add(new ListItem("250", "250"));
            ddlRadiusInMiles.Items.Add(new ListItem("500", "500"));
        private void FacilitiesDisplay(string ZipCode, string RadiusInMiles)
            //gets the resuls an puts them into a gridView
        protected void btnSearch_Click(object sender, EventArgs e)
            //Never gets to here
            string zip = txtZipCode.Text;
            string radius = ddlRadiusInMiles.SelectedValue;
            FacilitiesDisplay(zip, radius);
    //end class


    Thanks in Advance!





    Friday, July 17, 2009 6:17 PM


  • User1078276566 posted

     Thanks for sticking with me. I found the problem. Another developer added a form tag to one of the user controls. He has been flogged appropriately. The button is working now.



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 20, 2009 2:45 PM

All replies

  • User1383809551 posted


    The problem is with the validators. For the button to cause post back you have to enter a valid zip inside the text box. Then only the validation will sueess.

    If you dont want the button to validate the text box , put CausesValidation= "false" in the button (By default it is true, thats why it is validating the tet box)


    Friday, July 17, 2009 7:30 PM
  • User1078276566 posted

    Hi Ratheesh,

    I understand what you are saying, but I would like to prevent the form from posting if no value has been entered. Seems preety standard. In fact the validation works as it should. I revceive a validation warning if I submit the form without a proper zip code.

    The problem is that if I do enter a proper zip code nothing happens.


    Saturday, July 18, 2009 12:36 PM
  • User1383809551 posted

    Thats the only reason i would say for button not poast backing.Try to remove  UseSubmitBehavior="False" from button.
    Make sure that your regular expression validation is correct in this site
    Check here for US Zip code Regex validation



    Saturday, July 18, 2009 12:46 PM
  • User1078276566 posted

    Hi RatheeshC - were you able to run this on your machine?

    I checked the validation rule and I removed UseSubmitBehavior. Then I even removed the validation completely. Still the button does nothing when clicked.

    Does Anyone have any idea what is going on?

    Monday, July 20, 2009 1:13 PM
  • User1383809551 posted


    When i tried the code in my system , its working fine.

    Only difference in my code is I am using 


    instead of your spectrum.pagebase in the treatmentLocator page

    Monday, July 20, 2009 1:57 PM
  • User1078276566 posted

     Thanks for sticking with me. I found the problem. Another developer added a form tag to one of the user controls. He has been flogged appropriately. The button is working now.



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 20, 2009 2:45 PM
  • User2027633219 posted

    Wow reading this post just ended my 2hr debug session.... I introduced a form on a usercontrol somewhere that wasn't even visible, and I was having this issue in the Master page. Feel so stupid, but at least it works now!

    Just removed the form from the offending usercontrol that was on the page, wasn't needed anyway.

    Saturday, October 9, 2010 9:13 PM