Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,

I am new with JS. I have an ASP.Net web app that uses JS to check and uncheck checkboxes inside a gridview. The gridview is in a separate page, and the JS function is in a separate file. The JS function has a code
TotalChkBx = parseInt('<%= this.grdIndustry.Rows.Count %>');
...i get an error in this line, and in other lines that has a
this
function. What should i put to replace the this functions?

Thanks,

Franco
Posted

1 solution

The gridview is in a separate page, and the JS function is in a separate file
If so, then the below code would not work.
HTML
TotalChkBx = parseInt('<%= this.grdIndustry.Rows.Count %>');

In order to use the server delimiter <%= %>, you need to be on the same page.
 
Share this answer
 
Comments
Franco Cipriano 9-Jul-12 14:46pm    
so how do i count the number of rows in the gridview from a separate JS file?
Sandeep Mewara 9-Jul-12 15:00pm    
One possible way: pass the gridview id to the Javascript function. Find the gridview in JS using getElementById and then it's row count.
Prasad_Kulkarni 10-Jul-12 6:36am    
My 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900