Vote count:
0
I want to access the already created data table object in javascript code.
Below is my server-side code(code behind) on Page_Load:
DataTable tblField = new DataTable();
DataColumn col1 = new DataColumn("Name");
DataColumn col2 = new DataColumn("Value");
col1.DataType = System.Type.GetType("System.String");
col2.DataType = System.Type.GetType("System.String");
tblField.Columns.Add(col1);
tblField.Columns.Add(col2);
DataRow row1 = tblField.NewRow();
row1[col1] = "None";
row1[col2] = "None";
tblField.Rows.Add(row1);
DataRow row2 = tblField.NewRow();
row2[col1] = "ID";
row2[col2] = "ID";
tblField.Rows.Add(row2);
Javascript Code:
function GetItems()
{
var Items = eval('<%= tblField%>');
}
This is not working. I'm getting 'Items' as blank/empty
Please help!! Thanks in advance
asked 1 min ago
Read or access the datatable object in javascript
Aucun commentaire:
Enregistrer un commentaire