Problem with required field validator.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mathewgk80
    New Member
    • Sep 2007
    • 103

    Problem with required field validator.

    Hi all,

    I have two textboxes, txtName and txtDescription.

    i added required field validator to both of them.

    I have a Gridview in the same page.

    In tht gridview, i have a template field called "Delete". when i click on tht delete link. a javascript is generated which says "Do u want to delete this record?". and when i click yes the entire row will be deleted.

    The problem is that when i click on the delete in the gridview, required field validator is executed and i cant delete the record. before click on the delete, i have to enter some values in tht two text boxes.

    I tried a lot to find the solution.But i cant..

    Please help me...
  • nateraaaa
    Recognized Expert Contributor
    • May 2007
    • 664

    #2
    Are the two textboxes used to search for data that will be displayed in the gridview? I am assuming the required field validators have nothing to do with the delete functionality. If this is the case you should be able to mark the enabled property of the required field validators to false in the beginning of your Delete button click event. Give this a try and let us know if you find any other issues.

    Nathan

    Comment

    • mathewgk80
      New Member
      • Sep 2007
      • 103

      #3
      Hi,

      the text boxes are used to add data into gridview when clicking on Add button .

      I used requiredfieldva lidator.enabled =false.. but no change
      Required field validater is still working...

      regards,
      Mathew

      Comment

      • mynkow
        New Member
        • Jul 2007
        • 37

        #4
        Try custom validator or post some code.

        Comment

        • nateraaaa
          Recognized Expert Contributor
          • May 2007
          • 664

          #5
          I played around with the RequiredValidat or properties and if you set the following properties to false in your button click event this should work.

          RequiredFieldVa lidator.EnableC lientScript = false;
          RequiredFieldVa lidator.Enabled = false;

          Give this a try.

          Nathan

          Comment

          • rohitbce
            New Member
            • Aug 2007
            • 30

            #6
            on grid properti set cause validation false
            and when u insert a new record
            at that time check
            txtName = dgBlockDescript ion.Rows(dgBloc kDescription.Se lectedIndex).Ce lls(2).Controls (0)
            first find the cell value in one variable and after that set
            if(textss1.text ="")
            (
            exit sub
            )
            thatnks & Regard
            Rohit

            Comment

            • mathewgk80
              New Member
              • Sep 2007
              • 103

              #7
              Hi everyone,

              i got the solution...

              I have to go to Edit Template and select the template field and then put "Causes Validation" to false...

              Thank and Regards,
              Mathew

              Comment

              Working...