Problem with ASP:Button

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DFDavis

    Problem with ASP:Button

    I have a set of code that updates to a div tag through javascript
    whenever a checkbox is checked, however I need a way to get that
    information to the server side when the user uses the submit button.
    So I created an asp:button on the page, but for some reason, everytime
    I press the submit button, the page tries to reload and I get an error
    page, not an error from the program itself, just a normal error page
    for explorer.

    I've noticed that when I create the event handler it will create the
    method submit_click but inside the initialize component of the web
    generated code, it doesn't initialize the handler. How can I fix this
    so I can read in from the div tag when they press the button?

    Thanks,

    Dan

  • Ignacio Machin \( .NET/ C# MVP \)

    #2
    Re: Problem with ASP:Button

    hi

    post some code, both the declaration in the aspx page as the code behind


    --
    Ignacio Machin
    machin AT laceupsolutions .com

    "DFDavis" <dfdavis.mtu@gm ail.comwrote in message
    news:1160580962 .005534.247360@ m73g2000cwd.goo glegroups.com.. .
    >I have a set of code that updates to a div tag through javascript
    whenever a checkbox is checked, however I need a way to get that
    information to the server side when the user uses the submit button.
    So I created an asp:button on the page, but for some reason, everytime
    I press the submit button, the page tries to reload and I get an error
    page, not an error from the program itself, just a normal error page
    for explorer.
    >
    I've noticed that when I create the event handler it will create the
    method submit_click but inside the initialize component of the web
    generated code, it doesn't initialize the handler. How can I fix this
    so I can read in from the div tag when they press the button?
    >
    Thanks,
    >
    Dan
    >

    Comment

    • DFDavis

      #3
      Re: Problem with ASP:Button

      This is from the aspx declaration:

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

      And here is the handler and init code from the code behind:

      private void InitializeCompo nent()
      {
      this.btn_logout .Click += new
      System.Web.UI.I mageClickEventH andler(this.btn _logout_Click);
      this.Button1.Cl ick += new EventHandler(Bu tton1_Click);
      this.TextBox1.T extChanged += new
      EventHandler(Te xtBox1_TextChan ged);
      }

      protected void Button1_Click(o bject sender, EventArgs e)
      {
      throw new Exception("The method or operation is not
      implemented.");
      }

      Still haven't figured out how to get it to work for me so any help
      would be appreciated.

      Thanks,

      Dan

      Ignacio Machin ( .NET/ C# MVP ) wrote:
      hi
      >
      post some code, both the declaration in the aspx page as the code behind
      >
      >
      --
      Ignacio Machin
      machin AT laceupsolutions .com
      >
      "DFDavis" <dfdavis.mtu@gm ail.comwrote in message
      news:1160580962 .005534.247360@ m73g2000cwd.goo glegroups.com.. .
      I have a set of code that updates to a div tag through javascript
      whenever a checkbox is checked, however I need a way to get that
      information to the server side when the user uses the submit button.
      So I created an asp:button on the page, but for some reason, everytime
      I press the submit button, the page tries to reload and I get an error
      page, not an error from the program itself, just a normal error page
      for explorer.

      I've noticed that when I create the event handler it will create the
      method submit_click but inside the initialize component of the web
      generated code, it doesn't initialize the handler. How can I fix this
      so I can read in from the div tag when they press the button?

      Thanks,

      Dan

      Comment

      Working...