Calling javascript in for loop in code behind

i am using C# , in that i want to call a javascript function in for loop code behind ,i used RegisterClientScriptBlock and Page.ClientScript.RegisterClientScriptBlock, this will excute only once , i want to excute this function each time in a loop,please help me....

Client-side and server-side script are two different beasts. You cannot simply call a client-side script (in any fashion) inside your server-side code. Your registerclientscriptblock will simply place this script onto the page to be executed when the page is rendered client-side. This happens *after* all your server-side script as completed.

It is quite difficult to suggest what you should do here as we don't know what it is that you are really trying to achieve.

through for loop iam building a table, for each row , in a column i want to change images, for that i wrote that javascript, when i execute that javascript it only once excuting and working in first row

You can't! That is what I tried to explain, you cannot call javascript (which is executed on the client) within your loop executed on the server.

If you are building a table and from what I see here it has star ratings that you appear to be trying to set. Why cannot you simply set these on the server side as presumably you know what value and hence what images to show.

By all means have a client-side function that allows the user to change or reset these ratings but it makes no sense to have a client-side function set them, especially as it is not possible to acchieve what you appear to be trying to do with a mix of client/server code.

Oh.. I see what you are doing. The problem is that it's running so fast that you only see the images as they were in the last iteration of the loop. If you actually want to see them changing you have to put a delay in the for loop. Is that what you mean? You want to actually "see" these images changing? If so, then you can still use your javascript, but you don't have to register the script with ClientScriptManager. You can just have it launch when the user clicks a button or when the page loads.

Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…

In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?