0

i know it's a simple problem, i searched alot but couldn't find a solution
i have this button in aspx page:

<asp:Button runat="server" ID="btnSubmit" Text="Submit" OnClick="btnSubmit_Click" CssClass="btn"/>

the button works fine on my local machine. it writes to DB an email from textbox.
when i upload my webform to the server, the button refreshes the page but the event not firing.

please note: by button inside a div and it's hidden until a radio button is checked.


Thank you

Sam
  • 406
  • 1
  • 11
  • 24
  • 1
    Do you have any logging to provide details of what's happening. Perhaps you're receiving an error when connecting to the database. How do you know for sure the `button click event is not firing`? – Rick S Aug 26 '14 at 18:56
  • 1
    How do you know it's not firing? If you have access to the server, attach to the `w3wp.exe` process and set a breakpoint to see if it really doesn't get called. If you don't have access to the server, try something that would make it obvious whether the method is called or not. For example, throw an exception at the top of the method. If it does get called, then it should break the page. – Arian Motamedi Aug 26 '14 at 18:56
  • i checked if it writes to DB or not and it's not!! but it works locally, what could be the reason of not connecting or writing to DB on web server. – Sam Aug 26 '14 at 19:04
  • 1
    You may have to rebind the event, or button. You could always use an `UpdatePanel`. Though they're a pain, when your jQuery/Javascript executes it shouldn't break anything once the element is `hide()` or `show()`. – Greg Aug 26 '14 at 19:24
  • 1
    Put a try / catch around your database code to catch any exceptions and log them. Log4Net is perfect for this. If it's working locally but not on the server, it might be a permissions/firewall issue which you'd only pinpoint with proper exception handling. – Scotty Aug 26 '14 at 23:10

1 Answers1

0

i found the issue. i tried to read (not write) to see if i have a connection problem. The error i had solved in this link Login failed for user 'IIS APPPOOL\ASP.NET v4.0' and this solved my problem.

i hope this may help any one will have the same problem.

Thanks for all your help.

Community
  • 1
  • 1
Sam
  • 406
  • 1
  • 11
  • 24