Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I am trying to send Asp.net Contact form But when clicking on submit button page is refreshing and data are not submitting. the Contact form offline is working fine but after hosting the website it's not submitting data.
if anyone has a solution please send me.
thanks a lot.

What I have tried:

<div class="col-lg-8 text-white">
               Dear visitor is you have any query regarding Our services or Feed Back Please send us.<br>
           </div>
           <div class="col-lg-4">
               <div class="contact-section ">
                   <div class="container">
                       <div class="col-md-form-line">
                           <div class="form-group">
                               <asp:RequiredFieldValidator ID="RequiredFieldValidatorName" runat="server" ErrorMessage="Name is required" ControlToValidate="txtName" Text="*" ForeColor="Red"></asp:RequiredFieldValidator>
                               <asp:TextBox ID="txtName" runat="server" CssClass="form-control" ToolTip="Enter Name" placeholder="Enter Name"></asp:TextBox>
                           </div>
                           <div class="form-group">

                               <asp:RequiredFieldValidator ID="RequiredFieldValidatorEmail" runat="server" ErrorMessage="Email is required" ControlToValidate="txtEmail" Text="*" ForeColor="Red"></asp:RequiredFieldValidator>
                               <asp:RegularExpressionValidator ID="RegularExpressionValidatorEmail" runat="server" ErrorMessage="Please enter a valid email" Text="*" ForeColor="Red" ControlToValidate="txtEmail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                               <asp:TextBox ID="txtEmail" runat="server" CssClass="form-control" ToolTip="Enter Email" placeholder="Enter Email Id" TextMode="Email"></asp:TextBox>
                           </div>
                           <div class="form-group">

                               <asp:RequiredFieldValidator ID="RequiredFieldValidatorMobileno" runat="server" ErrorMessage="Moble No. is required" ControlToValidate="txtmobileNo" Text="*" ForeColor="Red"></asp:RequiredFieldValidator>
                               <asp:TextBox ID="txtmobileNo" runat="server" CssClass="form-control" ToolTip="Enter Your mobile Number" placeholder="Enter Your mobile Number" TextMode="Phone"></asp:TextBox>
                           </div>

                           <div class="form-group">

                               <asp:RequiredFieldValidator ID="RequiredFieldValidatorsub" runat="server" ErrorMessage="Subject is required" ControlToValidate="txtSubject" Text="*" ForeColor="Red"></asp:RequiredFieldValidator>
                               <asp:TextBox ID="txtSubject" runat="server" CssClass="form-control" ToolTip="Enter Subject" placeholder="Enter Subject"></asp:TextBox>
                           </div>
                           <div class="form-group">

                               <asp:RequiredFieldValidator ID="RequiredFieldValidatorMassage" ControlToValidate="txtMessage" runat="server" ErrorMessage="massage is required" Text="*" ForeColor="Red"></asp:RequiredFieldValidator>
                               <asp:TextBox ID="txtMessage" runat="server" CssClass="form-control" ToolTip="Enter Your Message " placeholder="Start to write Your Message" TextMode="MultiLine" Rows="5"></asp:TextBox>
                           </div>
                           <div>
                               <asp:Button ID="btnsend" runat="server" Text="Send Message" CssClass="btn btn-outline-info" OnClick="btnsend_Click" PostBackUrl="~/Thankyou.aspx"/>
                               <asp:Label ID="Status" runat="server" Text=""></asp:Label>
                               <asp:ValidationSummary HeaderText="Please fix the following error" ForeColor="Red" ID="ValidationSummary1" runat="server" BorderWidth="1" BorderColor="Red" />
                           </div>
                       </div>
                   </div>
               </div>
           </div>
Posted
Updated 30-Apr-19 5:57am
Comments
MadMyche 31-Mar-19 9:47am    
You will need to update this question (via the Improve Question) widget to include the code that is actually handling the submission; right now you only have the contents of the form
Nirav Prabtani 1-Apr-19 6:43am    
How can anyone help you without knowing what is happening code level on form submit event ?

We are not aware what you have written on .cs page.

Try to debug on your own way and for best practice put the try{} catch{} block and save the exception in a file or database.

1 solution

Do you mean that the data is not getting saved to database for your contact form, when you are hosting the site? If that's the case ,then please check database connection string,and also test other pages which saves data to the same database when you host the site.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900