Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ScriptManager.RegisterStartupScript not working
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
ScriptManager.RegisterStartupScript not working
Versions des environnements
Environment:
VB 9.0
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01628589
Message ID:
01628589
Vues:
40
Hi,

Here is the summary of what I am trying to do in an ASP.NET page and code behind:

The ASPX page has a hidden input text ID="NewStorage"
The code behind creates an array, serializes it and stores the value of the resulting string to the Value of input "NewStorage"
Then ScriptManager.RegisterStartupScript is supposed to store the value of the input "NewStorage" to the localStorage. But all I see in the local storage is a key but the value is "undefined" Here is the code:
         // PmXmlFiles is an Arraylist containing 3 strings (created before this line)

         string cPmXmlFiles;
         // Serialize the Arraylist using JsonConvert()
         cPmXmlFiles = JsonConvert.SerializeObject(PmXmlFiles);
         // I check in the debugger and the value cPmXmlFiles appears to be correct

         // set the value of the above string to the hidden Input
         NewStorage.Value = cPmXmlFiles;

         // I also check in the debugger that the Value of the NewStorage appears to be a string.

         // The line below is supposed to store the Value of NewStorage to the localStorage
         ScriptManager.RegisterStartupScript(this, GetType(), "cost_center_key_string", "localStorage.setItem('pm_xml_files', 
$('#NewStorage').val());", true);
         
         // But somehow it does not work
What am I missing?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform