Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 1.0/1.1
Rendere persistente script lato client
giovedì 09 giugno 2005 - 14.50
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
nandonando
Profilo
| Senior Member
398
messaggi | Data Invio:
gio 9 giu 2005 - 14:50
Ho salvato il mio script in una variabile str e quindi ho fatto Response.Write(str) non sò se è il modo migliore ma funziona
però vorrei sapere se la si può rendere persistente ossia che ad ogni postback non ci sia la necessità di ricrearla
Questo è quello che ho creato:
Dim I As String
Dim n As String
Dim scriptStringPrezzoBase_euro As String = "script language=JavaScript>"
Dim scriptStringPrezzoBase As String
'scriptString += "function ci(){"
scriptStringPrezzoBase_euro += "var PrezzoBase_euro=new Array("
scriptStringPrezzoBase += "var PrezzoBase=new Array("
''''
Dim strsql As String = "select * from tblContratti_tipi"
Dim sqlCommand1 As New SqlCommand(strsql, cn)
Try
cn.Open()
Dim rdrRATA As SqlDataReader = sqlCommand1.ExecuteReader(CommandBehavior.KeyInfo)
While rdrRATA.Read()
I = I & Replace(rdrRATA.Item("PrezzoBase_euro").ToString, ",", ".") & ","
n = n & Replace(rdrRATA.Item("PrezzoBase").ToString, ",", ".") & ","
End While
Catch ex As Exception
End Try
scriptStringPrezzoBase_euro += I
scriptStringPrezzoBase_euro = Mid(scriptStringPrezzoBase_euro, 1, (Len(scriptStringPrezzoBase_euro) - 1))
scriptStringPrezzoBase_euro += ");"
scriptStringPrezzoBase += n
scriptStringPrezzoBase = Mid(scriptStringPrezzoBase, 1, (Len(scriptStringPrezzoBase) - 1))
scriptStringPrezzoBase += ");"
scriptStringPrezzoBase_euro = scriptStringPrezzoBase_euro & scriptStringPrezzoBase
scriptStringPrezzoBase_euro += "</" + "script>"
Response.Write(scriptStringPrezzoBase_euro)
solo che lo devo ricreare ad ogni postbak come posso fare con Page.RegisterArrayDeclaration(...)
scusami ancora
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !