JavaScript function Checking the values before Inserting into database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • btreddy
    New Member
    • Oct 2008
    • 83

    #1

    JavaScript function Checking the values before Inserting into database

    Hii..,

    I've been searching for a solution ..but not yet found.Here is my requirement.

    In my webpage one button ,Edit, is available whenever user clicks on tht button ..it will displays one modalpopup window contains an updatepanel.. and inside that we've 10 textboxes and two buttons update and close.whenever user clicks on the update button ..it has to check whether all the textboxes has values or not ..if it yes continue if not alert the user saying tht so and so textbox is empty plz provide the value.

    How can i do this in ASP.NET 2.0 ,im using AJAX.

    My doubt is tht how can we display a popup from upon a popup..is it possible ??

    Kindly suggest me a solution ...

    Thank you,
    BTR.
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Dude - you'll find everything you need to know here - http://www.asp.net/learn/ajax-control-toolkit/ - check it out!

    Comment

    • btreddy
      New Member
      • Oct 2008
      • 83

      #3
      Thanks for teh reply dear.

      I solved it.

      I've created one javascript fuction which checks the values of the textboxes and i linked this function to the OnClientClick attribute of the update button.
      Code:
      <asp:Button ID="btnxxxxxx" runat="server" Text="Update" OnClick="btnxxxx_OnClick" CausesValidation="false" OnClientClick="javascript:Checkbeforeupdate()"/>
      
      and the javascript function is 
      
      function Checkbeforeupdate() 
          {
            var organizeremialid=document.getElementById('ctl00_BodyContent_xxxxxxxx');
            var presenteremialid=document.getElementById('ctl00_BodyContent_xxxxxxxx');
            
            if(organizeremialid.value=="" || presenteremialid.value=="")
            {
             alert('Please enter the organizer and presenters EmailIDs');
            }
          
          }
      Its working fine.

      Thank you..
      Rgds,
      BTR.
      Last edited by Frinavale; Feb 19 '09, 06:14 PM. Reason: added [code] tags

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        You could have also used a Validator Control to help you solve your problem.

        Comment

        • kenobewan
          Recognized Expert Specialist
          • Dec 2006
          • 4871

          #5
          Well done on finding a solution :).

          Comment

          Working...