Web Analytics Made Easy -
StatCounter Button event not firing in IE - any advice please! - CodingForum

Announcement

Collapse
No announcement yet.

Button event not firing in IE - any advice please!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Button event not firing in IE - any advice please!

    Hi,

    I have a asp:button with an onclick event. When clicked, it fires the onclick event in Firefox, but does absolutely nothing in Internet Explorer. The page doesn't even post back when the button is clicked.

    The button is contained in a panel. Here is the (shortened) code:

    aspx file:
    Code:
    <%@ Page language="c#" Codebehind="employees.aspx.cs" AutoEventWireup="false" Inherits="sas.web.admin.members.employees" %>
    <form id="empForm" runat="server" name="empForm" method="get">	
     <asp:Panel ID="panelAdd" Runat="server">
       <!-- some textboxes and dropdownlists here, won't include them all -->
       <asp:Button ID="butAdd" Text="Add Employee" Runat="server" OnClick="butAdd_Click"></asp:Button>
     </asp:Panel>
    </form>
    code behind file, the Add Employee method:
    Code:
    		protected void butAdd_Click(object sender, System.EventArgs e)
    		{
    			int eId = Int32.Parse(Request.QueryString["id"]);
    			string initials = Server.HtmlEncode(tbInitials.Text).Replace("'","''");
    			string firstName = Server.HtmlEncode(tbFirstName.Text).Replace("'","''");
    			string otherName = Server.HtmlEncode(tbOtherName.Text).Replace("'","''");
    			string surname = Server.HtmlEncode(tbSurname.Text).Replace("'","''");
    			string fullname = Server.HtmlEncode(tbFullName.Text).Replace("'","''");
    			string phone = Server.HtmlEncode(tbPhone.Text).Replace("'","''");
    			string fax = Server.HtmlEncode(tbFax.Text).Replace("'","''");
    			string email = Server.HtmlEncode(tbEmail.Text).Replace("'","''");
    			int ss = (cbSS.Checked)? 1:0;
    			int bg = (cbBG.Checked)? 1:0;
    			int paid = (cbBGPaid.Checked)? 1:0;
    			string title = ddlTitle.SelectedValue;
    			string lang = ddlLanguage.SelectedValue;
    			string emc = ddlEMC.SelectedValue;
    			string dpt = ddlDepartment.SelectedValue;
    			string pos = ddlPosition.SelectedValue;
    			if (surname.Length < 2) 
    			{
    				labelSubmit.ForeColor = System.Drawing.Color.Crimson;
    				labelSubmit.Text = "Some fields are invalid. Please ensure that you complete as many fields as possible.<br>";
    			} 
    			else 
    			{
    				string u = "INSERT INTO Employee(EntityId,Surname,LanguageID,EMCId,TitleId,Initials,FirstName,OtherFirstName,DepartId,PositionId,Phone,Fax,Email,SSRequested,BGRequested,BG2000Paid,FullName) "+
    					"VALUES("+eId+",'"+surname+"','"+lang+"','"+emc+"',"+title+",'"+initials+"','"+firstName+"','"+otherName+"',"+dpt+","+pos+",'"+phone+"','"+fax+"','"+email+"',"+ss+","+bg+","+paid+",'"+fullname+"')";
    				SqlHelper.ExecNonQuery(u);
    				labelSubmit.ForeColor = System.Drawing.Color.Navy;
    				labelSubmit.Text = "Employee added successfully.<br>";
    				listEmps();
    			}
    			
    		}

    There are some other linkbuttons on the page, which also fires events, and they are working fine in both browsers. Has anyone else come accross this problem before?

  • #2
    Your button declaration is like this:

    <asp:Button ID="butAdd" Text="Add Employee" Runat="server" OnClick="butAdd_Click"></asp:Button>
    try declaring like this:

    <asp:Button ID="butAdd" Text="Add Employee" Runat="server" OnClick="butAdd_Click" />



    Waiting reply if it works or not!

    Regards, Lallo

    Comment


    • #3
      Try changing the first line to:

      Code:
      <%@ Page language="c#" Codebehind="employees.aspx.cs" AutoEventWireup="false" Inherits="sas.web.admin.members.employees" EnableEventValidation="false"%>
      I'm not certain this will solve your problem, but it worked for me a while ago.
      http://curtdotnet.blogspot.com/

      Comment


      • #4
        is it functional now?

        Comment


        • #5
          Is the event wired up on the page load? Like this ( My systax is way off, look at other burron event to see how it should be, I guessed)
          this.button.butAdd_Click+= new System.web.Forms.buttonEventHandler(this.butAdd_Clickt);
          http://www.jiltedcitizen.com
          http://www.jiltedhosting.com
          http://www.livegreenforum.com

          Comment


          • #6
            Hi ppl!
            I have the same problem that Claudine had, so can anyone know the solution to this problem?

            Thanks for the attention and possible help.

            Best regards,
            Mesk

            Comment

            Working...
            X