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 2.0 / 3.5 / 4.0
ActionResult e parametri complessi da JavaScript
venerdì 26 novembre 2010 - 11.04
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
Elenco Tags
VB.NET
|
.NET 3.5
|
Visual Studio 2008
|
Javascript
volperubbia
Profilo
| Senior Member
375
messaggi | Data Invio:
ven 26 nov 2010 - 11:04
Ciao a tutti,
in un'applicazione ASP.NET MVC lancio da JavaScript delle richieste
ajax che vengono intercettate dalle rispettive funzioni HttpVerbs.Post
dei controller ...
Se i parametri accettati dalla funzione sono semplici, la cosa
è abbastanza immediata.
Lato JavaScript:
var myParameter = new Array();
for (i = 0; i < 10; i++) {
myParameter[myParameter.length] = "ID" + i.toString();
};
Ext.Ajax.request({
url: "...../Exec",
method: "POST",
params: { Types: myParameter },
success: function(response, options) { ... }
});
e lato VB.NET
<AcceptVerbs(HttpVerbs.Post)> Function Exec(ByVal Types() As String) As ActionResult
........
End Function
Ma se myParameter fosse un array di oggetti:
var myParameter = new Array();
for (i = 0; i < 10; i++) {
myParameter[myParameter.length] = { ID: i, Value: "..." }
};
<AcceptVerbs(HttpVerbs.Post)> Function Exec(ByVal Types() As Object) As ActionResult
........
End Function
... all'interno di quest'ultima funzione, come posso recuperare / leggere i dati?
Devo fare qualche cast particolare?
Grazie per l'attenzione,
Davide
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 !