Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » My form submisson works only when trace="true"

My form submisson works only when trace="true"

  #1 (permalink)  
New Member
Join Date: Feb 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Hazard My form submisson works only when trace="true"

I've been searching all forums and couldn't find the answer for my problem.My form is working only when I use tracing, otherwise, nothing is happening! Debug mode is not working; I can put break point only in .ascx.cs files, but it doesn't stop there.
Any help will be greatly appreciated.
Thank you,

Here is my code


<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" debug="true"  AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register src="~/Controls/ContactForm.ascx" tagname="ContactForm" tagprefix="contact_form" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
    <div id="content">
    <div id="content_area">
    <div class="clear_with_height"></div>
        <div class="title">Welcome to ASAP Heating &amp; Air Conditioning</div>
        <div id="sidebar_image"></div>

    <div id="contact_form">     
        <contact_form:ContactForm ID="ContactForm" runat="server" 
            PageDescription="Contact Form"/>
  <!-- End Of Content -->

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ContactForm.ascx.cs" debug="true" Inherits="Controls_Contact_Form" %>

<script language="javascript" type="text/javascript">
    function ValidateFields(source, args) 
        var name  = document.getElementById('<%=name.ClientID %>');
        var email = document.getElementById('<%=email.ClientID %>');
        var phone = document.getElementById('<%=phone.ClientID %>');
        var comments = document.getElementById('<%=comments.ClientID %>');
        if (phone.value != '' || email.value != '' || name.value != '' || comments.value != '')
            args.IsValid = true;
        else {
            args.IsValid = false;

<div class="title"> Make an Appointment</div><p></p>
    <div id="service_guy"></div>
   <div id="appointment">
     <%--<asp:UpdatePanel ID="UpdatePanel" runat="server">
            <asp:Panel ID="contact_form" runat="server">
          <asp:TextBox ID="name" runat="server" ></asp:TextBox>
            <asp:CustomValidator ID="ReqName"
                runat="server" ErrorMessage="Please enter your Name" ClientValidationFunction="ValidateFields" 
                   OnServerValidate="CustomValidator_ServerValidate" ></asp:CustomValidator><br />
          <asp:TextBox ID="email" runat="server"></asp:TextBox>
            <asp:CustomValidator ID="ReqEmail"
                runat="server" ErrorMessage="Please enter your email address" ClientValidationFunction="ValidateFields" 
                Display="Dynamic" ForeColor="White"  OnServerValidate="CustomValidator_ServerValidate"></asp:CustomValidator><br />
            <asp:TextBox ID="phone" runat="server" ></asp:TextBox>
            <asp:CustomValidator ID="ReqPhone"
                runat="server" ErrorMessage="Please enter phone number" ClientValidationFunction="ValidateFields" 
                Display="Dynamic" ForeColor="White" ></asp:CustomValidator><br />
              <p><asp:TextBox ID="comments"  runat="server"  TextMode="MultiLine" ForeColor="#0033CC" Columns="16" Enabled="True"></asp:TextBox></p><br />
              <asp:CustomValidator ID="ReqComments"
                runat="server" ErrorMessage="Please enter comments" ClientValidationFunction="ValidateFields" 
                Display="Dynamic" ForeColor="White"  OnServerValidate="CustomValidator_ServerValidate"></asp:CustomValidator><br />

              <asp:Button ID="btnSend" runat="server" CssClass="button"  OnClick="btn_Send"  /><br />
              <div class="clear_with_height"></div>
          <asp:ValidationSummary ID="ValidationSummary" runat="server" ShowMessageBox="True" />
       <%-- <asp:Label ID="lblMessage" runat="server" Text="Message Sent" Visible="False" 
       <%-- </ContentTemplate>
      <%-- <asp:UpdateProgress ID="UpdateProgress" runat="server" AssociatedUpdatePanelID="UpdatePanel">
            <div class="PleaseWait">Please Wait...</div>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;

public partial class Controls_Contact_Form : System.Web.UI.UserControl
    protected void Page_Load(object sender, EventArgs e)

        protected void btn_Send(object sender, EventArgs e)
          if (Page.IsValid)


    protected void CustomValidator_ServerValidate(object source, ServerValidateEventArgs args)
        //Trace.Write(string.Format("Checking validation", args.IsValid));

        //if (args.IsValid)
            if (phone.Text != string.Empty)
                args.IsValid = true;
            else if (phone.Text == string.Empty)
                args.IsValid = false;
       // else
       // {
        //    Trace.Warn("Custom category", "no value for args");

  public string PageDescription { get; set; }
Reply With Quote


debug, postback, trace

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed with an upload form jameskinnear PHP 3 01-28-10 05:44 PM
Finishing touches to my Booking Form loll80 PHP 1 01-20-10 06:06 PM
Do not submit form if value is... loll80 HTML/XHTML/XML 1 01-20-10 12:17 AM
focus is lost once modal form is unloaded substance Visual Basic 0 01-31-05 08:29 PM
checkCheckboxGroup broken after form consolidation ski_woman JavaScript 0 01-12-05 11:00 AM

All times are GMT -5. The time now is 01:59 AM.
vBulletin® Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.