Gautam Buddha Temple Varanasi,Varanasi - Buddhist Pilgrimage

Friday, September 10, 2010

Javascript validation for Gridview footer textbox

 Javascript validation for Gridview footer textbox  
 Here gridview have footer row that cantain dropdownlist and two textbox.This javascript validate these fields while inserting record in database.  
 function ValidateGrid()  
 {   
      ddlNewCountry = document.getElementById('<%=((DropDownList)gv.FooterRow.FindControl("ddlNewCountry")).ClientID%>');  
      txtNewEmpName = document.getElementById('<%=((TextBox)gv.FooterRow.FindControl("txtNewEmpName")).ClientID %>');  
      txtNewAge = document.getElementById('<%=((TextBox)gv.FooterRow.FindControl("txtNewAge")).ClientID %>');  
      if(ddlNewCountry.value == 0)  
      {  
           alert("Please Select Country...!");  
           ddlNewCountry.focus();  
           return false;  
      }  
      if(txtNewEmpName.value == 0)  
      {  
           alert("Please Enter Emp name...!");  
           txtNewEmpName.focus();  
           return false;  
      }  
      if(txtNewAge.value == 0)  
      {  
           alert("Please Enter age...!");  
           txtNewAge.focus();  
           return false;  
      }   
      return true;   
 }  

1 comment:

  1. This is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Javascript Training in Chennai . or learn thru JavaScript Online Training India. Nowadays JavaScript has tons of job opportunities on various vertical industry.

    ReplyDelete