Connecting Tech Pros Worldwide Forums | Help | Site Map

JavaScript function Checking the values before Inserting into database

Member
 
Join Date: Oct 2008
Posts: 70
#1: Feb 19 '09
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's Avatar
Moderator
 
Join Date: Dec 2006
Posts: 4,745
#2: Feb 19 '09

re: JavaScript function Checking the values before Inserting into database


Dude - you'll find everything you need to know here - http://www.asp.net/learn/ajax-control-toolkit/ - check it out!
Member
 
Join Date: Oct 2008
Posts: 70
#3: Feb 19 '09

re: JavaScript function Checking the values before Inserting into database


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.
Expand|Select|Wrap|Line Numbers
  1. <asp:Button ID="btnxxxxxx" runat="server" Text="Update" OnClick="btnxxxx_OnClick" CausesValidation="false" OnClientClick="javascript:Checkbeforeupdate()"/>
  2.  
  3. and the javascript function is 
  4.  
  5. function Checkbeforeupdate() 
  6.     {
  7.       var organizeremialid=document.getElementById('ctl00_BodyContent_xxxxxxxx');
  8.       var presenteremialid=document.getElementById('ctl00_BodyContent_xxxxxxxx');
  9.  
  10.       if(organizeremialid.value=="" || presenteremialid.value=="")
  11.       {
  12.        alert('Please enter the organizer and presenters EmailIDs');
  13.       }
  14.  
  15.     }
  16.  
  17.  
Its working fine.

Thank you..
Rgds,
BTR.
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,137
#4: Feb 19 '09

re: JavaScript function Checking the values before Inserting into database


You could have also used a Validator Control to help you solve your problem.
kenobewan's Avatar
Moderator
 
Join Date: Dec 2006
Posts: 4,745
#5: Feb 20 '09

re: JavaScript function Checking the values before Inserting into database


Well done on finding a solution :).
Reply


Similar ASP.NET bytes