Embed ASP.NET server code in JavaScript
- by hotcoder
I've embeded the following server side code within <script tag.
<% Dim dataTable As DataTable = cTab.getTabs(Session("UserID"))
If (dataTable.Rows.Count > 0) Then
For i As Int16 = 0 To dataTable.Rows.Count%>
{
contentEl: 'tab'+'<%dataTable.Rows(0)("TabID").ToString()%>',
title: '<%dataTable.Rows(0)("TabName").ToString()%>',
closable: false,
autoScroll: true
},
<% Next
End If %>
But it is not returning the desired results due to syntax problems. How can I write it correctly?