RadGrid with Inline editing

2 posts, 1 answers
  1. Amitkumar
    Amitkumar avatar
    66 posts
    Member since:
    Aug 2009

    Posted 30 Nov 2009 Link to this post

    Hello Friends,

    i am using inline editing, during insert a record that time i would like to validate entered email address is valid or not using javascipt, waiting for your reply.

    Thanks & Regards,
    Amit Prajapati
  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Dec 2009 Link to this post

    Hello Amit,

    You can try out the following code and see if it helps:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
            if (e.Item is GridDataInsertItem && e.Item.OwnerTableView.IsItemInserted) 
                GridDataInsertItem insertItem = (GridDataInsertItem)e.Item; 
                TextBox txtbx = (TextBox)insertItem["Email"].Controls[0]; 
                LinkButton btn = (LinkButton)insertItem.FindControl("PerformInsertButton"); 
                btn.Attributes.Add("onclick""return emailcheck('" + txtbx.ClientID + "');"); 

    function emailcheck(textbx) 
           var txtbx = document.getElementById(textbx); 
           var str = txtbx.value; 
            if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2,4})$/.test(str)) 
              alert('valid address');    
              return true
               alert('invalid address');   
               return false

Back to Top