Bonjour,
Sur une page, j'ai un button asp qui permet d'exporter un CSV et je dois mette le curseur en "occupé" pendant le traitement.
Pas de problème pour changer le curseur sur le onclick, c'est fait avec un simple :
Par contre, je n'arrive pas à remettre le curseur en normal à la fin du traitement.Code:btnExporterCsv.Attributes.Add("onclick", "document.body.style.cursor = 'wait';");
J'ai essayé pas mal de solution tel que :
http://www.developpez.net/forums/d45...t/#post2785750
http://www.dotnetcurry.com/showarticle.aspx?ID=274
et moult pages sur Stackoverflow et CodeProject, mais rien ne marche :?
Voici le code asp du clic du button :
Si vous avez une idée ?Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 protected void btnExporterCsv_Click(object sender, EventArgs e) { // recuperation des criteres listeCriteres = recupererListeCriteres(); if (listeCriteres.Count == 0) { AfficherMessage("Liste de projets", "Au moins un critère soit être saisi", Severity.Warn); return; } RechercherPrj(listeCriteres); if (listeProjet != null && listeProjet.Count > 0) { // formattage du nom de fichier : Planification_YYYYMMDD.csv DateTime aujourdhui = DateTime.Now; string nomFichierCSV = string.Format("ExportTotalSRV_{0}.csv", aujourdhui.ToString("yyyyMMdd")); //... // création du memory stream msRetour //... // Supprime tout le contenu du flux de sortie envoyé au client this.Response.Clear(); // Ajout d'un en-tête décrivant le flux envoyé au client this.Response.AddHeader("content-disposition", "attachment; filename=" + nomFichierCSV); this.Response.ContentType = "application/csv"; Encoding type_encode_prevu = srvExport.getConstEncodage(); this.Response.ContentEncoding = type_encode_prevu; this.Response.BinaryWrite(type_encode_prevu.GetPreamble()); // Response.BinaryWrite(msRetour.ToArray()); // test pour remettre le curseur en default //if (!Page.ClientScript.IsStartupScriptRegistered("Curseur_Normal")) //{ // Page.ClientScript.RegisterStartupScript // (this.GetType(), "Curseur_Normal", "Curseur_Normal();", true); //} Page.ClientScript.RegisterStartupScript(this.GetType(), "Curseur_Normal", "document.body.style.cursor = 'default';",true); // Fin de la réponse. Le code après n'est pas exécuté this.Response.End(); } else { AfficherMessage("Export Planification", "Aucun projet dans l'export demandé !", Severity.Error); } }