Sheikh parvaz

Sheikh parvaz

  • NA
  • 199
  • 108.3k

pass array from asp.net to javascript

Apr 29 2015 7:38 AM
Hi,
 I have an array in asp.net in page_load method which I want to pass to javascript : 
 
C#:
 
EmpDBClass empobj = new EmpDBClass();
DataTable dtCheckValue = empobj.dtGetDataTable("EPS_GetBookedValues");
var bookedarray = dtCheckValue.AsEnumerable().Select(r => r.Field<string>("Name")).ToArray();
 
javascript:
 
var bookedSeats = <%new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(this.bookedarray);%>
 
problem is  Bookedarray  can not be found .
 
Kindly help 
 
 

Answers (2)