View Single Post
  #2 (permalink)  
Old March 31st, 2010, 09:17 AM
PeterPeiGuo PeterPeiGuo is offline
Friend of Wrox
Join Date: Dec 2008
Location: , , .
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts

Actually you didn't assign a C# array to javascript array, or assign a C# integer to a javascript integer. What you did was build a string in C#, which should contain a piece of valid javascript, and then register it with ClientScriptManager.

The way you did is hard to read and hard to debug. The best way is to define your javascript function in its own .js file, or between <script></script>. In your C# code, you simply say:
cs.RegisterClientScriptBlock(t, s2, "someJavascriptFunction()", true);

Last edited by PeterPeiGuo; March 31st, 2010 at 09:21 AM..