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
  1. Home
  2. General Programming
  3. C#
  4. Cant find onClick function in C#

Cant find onClick function in C#

Scheduled Pinned Locked Moved C#
csharpsysadminhelpquestion
8 Posts 4 Posters 0 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.
  • U Offline
    U Offline
    User 9021337
    wrote on last edited by
    #1

    i m very new in C# ,in my clients registration form

    <td align="center" style="font-family: tahoma; font-size: 11px;">
    <asp:Button ID="Button1" runat="server" Font-Names="Tahoma" Font-Size="11px" Height="22px"
    OnClick="Button1_Click" Text="Register" Width="74px" OnClientClick="return IsEmpty();" />
    </td>

    on click button1_click function is geting called,but i can not find button1_click,nad if i remove the function its not getting postback ASP.registration_aspx' does not contain a definition for 'Button1_C' and no extension method 'Button1_C' accepting a first argument of type 'ASP.registration_aspx' could be found (are you missing a using directive or an assembly reference?) Plz help me to find solution for it

    Thnx in Advance

    S A A 3 Replies Last reply
    0
    • U User 9021337

      i m very new in C# ,in my clients registration form

      <td align="center" style="font-family: tahoma; font-size: 11px;">
      <asp:Button ID="Button1" runat="server" Font-Names="Tahoma" Font-Size="11px" Height="22px"
      OnClick="Button1_Click" Text="Register" Width="74px" OnClientClick="return IsEmpty();" />
      </td>

      on click button1_click function is geting called,but i can not find button1_click,nad if i remove the function its not getting postback ASP.registration_aspx' does not contain a definition for 'Button1_C' and no extension method 'Button1_C' accepting a first argument of type 'ASP.registration_aspx' could be found (are you missing a using directive or an assembly reference?) Plz help me to find solution for it

      Thnx in Advance

      S Offline
      S Offline
      Sebastian T Xavier
      wrote on last edited by
      #2

      just check registration.aspx.cs and let us know....

      U 2 Replies Last reply
      0
      • U User 9021337

        i m very new in C# ,in my clients registration form

        <td align="center" style="font-family: tahoma; font-size: 11px;">
        <asp:Button ID="Button1" runat="server" Font-Names="Tahoma" Font-Size="11px" Height="22px"
        OnClick="Button1_Click" Text="Register" Width="74px" OnClientClick="return IsEmpty();" />
        </td>

        on click button1_click function is geting called,but i can not find button1_click,nad if i remove the function its not getting postback ASP.registration_aspx' does not contain a definition for 'Button1_C' and no extension method 'Button1_C' accepting a first argument of type 'ASP.registration_aspx' could be found (are you missing a using directive or an assembly reference?) Plz help me to find solution for it

        Thnx in Advance

        A Offline
        A Offline
        AmitGajjar
        wrote on last edited by
        #3

        hi, As you are new with .NET , follow below simple step. 1) remove this button from page. 2) add button control through drag and drop 3) double click on button. step 3 should create click event of the button and it should also create event handler in code behind page. let us know if it works for you. thanks -Amit.

        1 Reply Last reply
        0
        • S Sebastian T Xavier

          just check registration.aspx.cs and let us know....

          U Offline
          U Offline
          User 9021337
          wrote on last edited by
          #4

          i cant find registration.aspx.cs in the folder

          1 Reply Last reply
          0
          • S Sebastian T Xavier

            just check registration.aspx.cs and let us know....

            U Offline
            U Offline
            User 9021337
            wrote on last edited by
            #5

            i cant find registration.aspx.cs in the folder only 4 aspx files are dere

            1 Reply Last reply
            0
            • U User 9021337

              i m very new in C# ,in my clients registration form

              <td align="center" style="font-family: tahoma; font-size: 11px;">
              <asp:Button ID="Button1" runat="server" Font-Names="Tahoma" Font-Size="11px" Height="22px"
              OnClick="Button1_Click" Text="Register" Width="74px" OnClientClick="return IsEmpty();" />
              </td>

              on click button1_click function is geting called,but i can not find button1_click,nad if i remove the function its not getting postback ASP.registration_aspx' does not contain a definition for 'Button1_C' and no extension method 'Button1_C' accepting a first argument of type 'ASP.registration_aspx' could be found (are you missing a using directive or an assembly reference?) Plz help me to find solution for it

              Thnx in Advance

              A Offline
              A Offline
              Alireza C
              wrote on last edited by
              #6

              Amit Answer is enough for you to solve your problem but I want to tell you about setting events in Asp.net Forms. When you create control in Asp.net Form and then you want to create event for that,You can create event code in C# code of Asp.net Page. Because of this you should set the type of event and name of it by tag in Asp.net page then go to the C# page of it and create the handle code for your event. For example I want to create onclick event for button in my page. First you write the button code in Asp.net Page same as this code:

              <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

              Then go to C# page and create event for that button same as this code:

              protected void Button1_Click(object sender, EventArgs e)
              {

              }

              The important thing is the name of event in the tag and the name event in c# code should be same. It's very simple and I believe you can do it so if it works let me know.

              A 1 Reply Last reply
              0
              • A Alireza C

                Amit Answer is enough for you to solve your problem but I want to tell you about setting events in Asp.net Forms. When you create control in Asp.net Form and then you want to create event for that,You can create event code in C# code of Asp.net Page. Because of this you should set the type of event and name of it by tag in Asp.net page then go to the C# page of it and create the handle code for your event. For example I want to create onclick event for button in my page. First you write the button code in Asp.net Page same as this code:

                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

                Then go to C# page and create event for that button same as this code:

                protected void Button1_Click(object sender, EventArgs e)
                {

                }

                The important thing is the name of event in the tag and the name event in c# code should be same. It's very simple and I believe you can do it so if it works let me know.

                A Offline
                A Offline
                AmitGajjar
                wrote on last edited by
                #7

                thanks for mention my name in your answer :)

                A 1 Reply Last reply
                0
                • A AmitGajjar

                  thanks for mention my name in your answer :)

                  A Offline
                  A Offline
                  Alireza C
                  wrote on last edited by
                  #8

                  Your Welcome Dear Friend.

                  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