Ecco, con un po' di codice si ragiona meglio. Ci sono diversi errori:
1) Dentro un controllo server non funziona la sintassi:
<%=variabile_server%>
ma devi mettere eventualmente:
<%#variabile_server%>
e contemporaneamente devi mettere, per esempio nel load:
Me.MioControllo.DataBind()
2) Non hai messo l'istruzione più importante:
Option Strict On
Questa istruzione permette di far lavorare il basic decentemente, come il c#
Comunque, prova così:
pagina aspx
codice:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="prove_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Prova di passaggio varibili lato server -> lato client</title>
<script language="javascript" type="text/javascript">
// <!CDATA[
window.onload = function()
{
var count = <%=count %>;
document.getElementById("span1").innerHTML = count;
};
// ]]>
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />
count lato server: <asp:Label ID="Label1" runat="server" ></asp:Label>
<hr />
count lato client: <span id="span1"></span>
</div>
</form>
</body>
</html>
pagina di codice
codice:
Option Strict On
Partial Class prove_Default
Inherits System.Web.UI.Page
Protected count As Integer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then ' Primo avvio dell'Application Web
Me.Session("Conta") = 0
Label1.Text = Session("Conta").ToString
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
count = CInt(Session("Conta")) + 1
Session("Conta") = count
Label1.Text = count.ToString
End Sub
End Class
L'ho provato e va.
Prova adesso ad utilizzare i temi e metti nel web.config questo:
codice:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<pages styleSheetTheme="Tema1"></pages>
</system.web>
</configuration>