Friday, July 24, 2009

Issuing a javascript object by ASP.NET at load time

This is a nice feature ASP.NET provides that ASP.NET is providing a javascript object populated with data which can be used by client-side script very effectively. Let see this step by step.
Steps:
1. Suppose in ASP.NET you are using some variable (ex:testaskingprices) having some value. Now you want to transfer this value to access by the client-side code. So then you have execute this code in Page_Load event of page

this.ClientScript.RegisterArrayDeclaration("myAskPriceList", testaskingprices);

where
testaskingprices=the ASP.NET variable
myAskPriceList=the javascript variable issued for use

**************************************
Masud (25.7.9)

No comments:

Post a Comment