Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Submit button, onClick does not work automaticlly

Submit button, onClick does not work automaticlly

Scheduled Pinned Locked Moved ASP.NET
tutorial
9 Posts 4 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nour123
    wrote on last edited by
    #1

    Hi All... I have a form that adds users to the application, I use a submit button to add with event onClick_Button, when I insert all data in fields and then press enter, it does not add until I click on to the submit button, I want to know how to fire the onClick_button event when I click enter button,, Thanks alot... Nour Abdel-Salam

    B 1 Reply Last reply
    0
    • N nour123

      Hi All... I have a form that adds users to the application, I use a submit button to add with event onClick_Button, when I insert all data in fields and then press enter, it does not add until I click on to the submit button, I want to know how to fire the onClick_button event when I click enter button,, Thanks alot... Nour Abdel-Salam

      B Offline
      B Offline
      badgrs
      wrote on last edited by
      #2

      This is probably to do with how browsers handle submit buttons and forms. If there is only one submit button (and I mean an input with type="submit" on the client, whatever server-side controls you have) this should no problem, but if the button is rendered as type="button" or there is more than one this won't happen (although if theres more than one I think it fires the first....could be wrong). Either the submit button isn't really rendering as a proper submit or you have more than one on your page.

      N 1 Reply Last reply
      0
      • B badgrs

        This is probably to do with how browsers handle submit buttons and forms. If there is only one submit button (and I mean an input with type="submit" on the client, whatever server-side controls you have) this should no problem, but if the button is rendered as type="button" or there is more than one this won't happen (although if theres more than one I think it fires the first....could be wrong). Either the submit button isn't really rendering as a proper submit or you have more than one on your page.

        N Offline
        N Offline
        nour123
        wrote on last edited by
        #3

        Thanx for your response My form has only 2 textboxes and a submit button (type submit)... When I press enter, it does not insert the data, until i press the button by mouse... regards

        B 1 Reply Last reply
        0
        • N nour123

          Thanx for your response My form has only 2 textboxes and a submit button (type submit)... When I press enter, it does not insert the data, until i press the button by mouse... regards

          B Offline
          B Offline
          badgrs
          wrote on last edited by
          #4

          Can you post the markup code?

          P N 3 Replies Last reply
          0
          • B badgrs

            Can you post the markup code?

            P Offline
            P Offline
            peshawarcoder
            wrote on last edited by
            #5

            web.config is as under:

            web2.config is as under:

            ObjectAConfiguration class is as under: using System; using System.Collections.Generic; using System.Text; using System.Configuration; using System.Xml; namespace MyApp { [Serializable] public class ObjectAConfiguration:ConfigurationSection { #region Properties [ConfigurationProperty("property1", DefaultValue = 60.00F)] public float Property1 { get { return (float)this["property1"]; } set { this["property1"] = value; } } [ConfigurationProperty("property2", DefaultValue = 1.50F)] public float Property2 { get { return (float)this["property2"]; } set { this["property2"] = value; } } #endregion } } Problem Area is bellow: MyApp.ObjectAConfiguration objAConf= (MyApp.ObjectAConfiguration)ConfigurationManager.GetSection("objectAConfiguration"); The above did not find the web2.config file and thus objectASection section. Thanks.

            G 1 Reply Last reply
            0
            • B badgrs

              Can you post the markup code?

              P Offline
              P Offline
              peshawarcoder
              wrote on last edited by
              #6

              Sorry! the site did not display my contents entirly and correctly. web.config is as under:

              web2.config is as under:

              ObjectAConfiguration class is as under:

              using System;
              using System.Collections.Generic;
              using System.Text;

              using System.Configuration;
              using System.Xml;

              namespace MyApp
              {
              [Serializable]
              public class ObjectAConfiguration:ConfigurationSection
              {

                  #region Properties
                  \[ConfigurationProperty("property1", DefaultValue = 60.00F)\]      
                  public float Property1
                  {
                      get { return (float)this\["property1"\]; }
                      set { this\["property1"\] = value; }
                  }
              
                  \[ConfigurationProperty("property2", DefaultValue = 1.50F)\]      
                  public float Property2
                  {
                      get { return (float)this\["property2"\]; }
                      set { this\["property2"\] = value; }
                  }
                  #endregion
              }
              

              }

              Problem Area is bellow:

              MyApp.ObjectAConfiguration objAConf= (MyApp.ObjectAConfiguration)ConfigurationManager.GetSection("objectAConfiguration");

              The above did not find the web2.config file and thus objectASection section. Thanks.

              1 Reply Last reply
              0
              • P peshawarcoder

                web.config is as under:

                web2.config is as under:

                ObjectAConfiguration class is as under: using System; using System.Collections.Generic; using System.Text; using System.Configuration; using System.Xml; namespace MyApp { [Serializable] public class ObjectAConfiguration:ConfigurationSection { #region Properties [ConfigurationProperty("property1", DefaultValue = 60.00F)] public float Property1 { get { return (float)this["property1"]; } set { this["property1"] = value; } } [ConfigurationProperty("property2", DefaultValue = 1.50F)] public float Property2 { get { return (float)this["property2"]; } set { this["property2"] = value; } } #endregion } } Problem Area is bellow: MyApp.ObjectAConfiguration objAConf= (MyApp.ObjectAConfiguration)ConfigurationManager.GetSection("objectAConfiguration"); The above did not find the web2.config file and thus objectASection section. Thanks.

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                Use the "Ignore HTML" option when posting markup code.

                --- Year happy = new Year(2007);

                1 Reply Last reply
                0
                • B badgrs

                  Can you post the markup code?

                  N Offline
                  N Offline
                  nour123
                  wrote on last edited by
                  #8

                  Imports System.Data Imports System.Data.OleDb Partial Class Links Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Session("ID") = Nothing Then Response.Redirect("default.aspx?flag=2") End If Dim conn As New OleDbConnection Dim cm As New OleDb.OleDbCommand Dim dr As OleDb.OleDbDataReader HyperLink1.Enabled = False HyperLink2.Enabled = False HyperLink3.Enabled = False Try conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Hosting;Data Source=JICC" conn.Open() cm.Connection = conn cm.CommandText = "Select * From users where u_id=" & Session("id") & " " dr = cm.ExecuteReader() If dr.HasRows Then Do While dr.Read If dr.GetValue(7) = 1 Then HyperLink1.Enabled = True End If If dr.GetValue(8) = 1 Then HyperLink2.Enabled = True End If If dr.GetValue(9) = 1 Then HyperLink3.Enabled = True End If Loop dr.Close() conn.Close() Else dr.Close() conn.Close() End If Catch ex As Exception Response.Write(Err.Description) End Try End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conn As New OleDbConnection Dim cm As New OleDb.OleDbCommand Dim dr As OleDb.OleDbDataReader Try conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Hosting;Data Source=JICC" conn.Open() cm.Connection = conn cm.CommandText = "Select * From types where t_name='" & TextBox1.Text & "' " dr = cm.ExecuteReader() If dr.HasRows Then Do While dr.Read Label1.Text = " نوع العقار موجود سابقاُ" Label1.Visible = True Loop

                  B 1 Reply Last reply
                  0
                  • N nour123

                    Imports System.Data Imports System.Data.OleDb Partial Class Links Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Session("ID") = Nothing Then Response.Redirect("default.aspx?flag=2") End If Dim conn As New OleDbConnection Dim cm As New OleDb.OleDbCommand Dim dr As OleDb.OleDbDataReader HyperLink1.Enabled = False HyperLink2.Enabled = False HyperLink3.Enabled = False Try conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Hosting;Data Source=JICC" conn.Open() cm.Connection = conn cm.CommandText = "Select * From users where u_id=" & Session("id") & " " dr = cm.ExecuteReader() If dr.HasRows Then Do While dr.Read If dr.GetValue(7) = 1 Then HyperLink1.Enabled = True End If If dr.GetValue(8) = 1 Then HyperLink2.Enabled = True End If If dr.GetValue(9) = 1 Then HyperLink3.Enabled = True End If Loop dr.Close() conn.Close() Else dr.Close() conn.Close() End If Catch ex As Exception Response.Write(Err.Description) End Try End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conn As New OleDbConnection Dim cm As New OleDb.OleDbCommand Dim dr As OleDb.OleDbDataReader Try conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Hosting;Data Source=JICC" conn.Open() cm.Connection = conn cm.CommandText = "Select * From types where t_name='" & TextBox1.Text & "' " dr = cm.ExecuteReader() If dr.HasRows Then Do While dr.Read Label1.Text = " نوع العقار موجود سابقاُ" Label1.Visible = True Loop

                    B Offline
                    B Offline
                    badgrs
                    wrote on last edited by
                    #9

                    As I said: "Could you post the markup code?"

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups