troubleshooting Question

create a for each loop for javascript in c#

Avatar of Bran-Damage
Bran-DamageFlag for United States of America asked on
C#JScript
8 Comments3 Solutions363 ViewsLast Modified:
I need to create a for each loop for javascript in my c# code.

I have a list variable.  I want to pass this into my java script, and then when my java script gets fired off,  i want it to go through the list and do something.

Basically i need to iterate through the lstStrLabels list.  and during each iteration, i need to grab the string value out of it, and put it in the sprint.pagecreate(....) function and pImage will be the value that is in the element in the array for the current itteration.

I am building this string i c#, and then I am passing it to my registerstartupscript.
StrImage += "<script type=\"text/javascript\" language=\"javascript\">";
        StrImage += "var Sprint = document.getElementById(\"printdocument\");";
        StrImage += "var prname='" + subObj.strPrinterName + "';";
        StrImage += "var pImage='" + lstStrLabels + "';";
        StrImage += "var pNoCopies='" + subObj.iNoOfPrints.ToString() + "';";
        StrImage += "var Weg= SPrint.pagecreate(pImage, prname, pNoCopies);";
        StrImage += "</script>";
ASKER CERTIFIED SOLUTION
Adam Menkes
C# ASP.NET Developer
Join our community to see this answer!
Unlock 3 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros