Skip to content

Validating DataList. when datalist count is zero

aadi kumary

Asked Sep 21, 2016, 1:23 AM EDT1 answer
Share
LinkedInX
 -
 here i am  uploading company products, after that i am saving  all products into databas.
i want give the RequiredFieldValidator to DataList,  when  DataList is empty.
and also display in ValidationSummary  
 
// if (DataListCProductsImgs.Items.Count=0 ) 
 //       RequiredFieldValidator  Fire ---"Upload  one product" 
 
i want to do in javascript or jquer ... 
i tryed.. 
custom validator  , But  ControlToValidate= ?
JavaScript
 function gettotalRows(sender, arguments)
                               {
                                   var totalRowCount = $("[id*=DataListCompanyImgs] tr").length;
                                   if(totalRowCount>0)
                                   {
      arguments.IsValue = true;
                                   }


                                }
 
is there any another method.. to validate clientside.
Help me ..
 
Thanks 
 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Delpin Susai Raj
    0
    http://stackoverflow.com/questions/5909664/data-list-binding-with-some-text-and-validating-datalist
    0