begin process at 2012 02 14 05:24:06
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

ASP.Net

 > AFFICHER LE CONTENU D'UN FICHIER XML VIA UN CONTRÔLE DATAGRID

AFFICHER LE CONTENU D'UN FICHIER XML VIA UN CONTRÔLE DATAGRID


 Information sur la source

Note :
9 / 10 - par 1 personne
9,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :ASP.Net Source .NET ( DotNet ) Niveau :Initié Date de création :24/05/2002 Date de mise à jour :24/05/2002 18:55:06 Vu / téléchargé :14 549 / 544

Auteur : Skyride

Ecrire un message privé
Commentaire sur cette source (1)
Ajouter un commentaire et/ou une note

 Description

Voici un petit bout de code pour afficher des données XML dans un contrôle de type DATAGRID...    

Source

  • <%@ Page Language="VB" %>
  • <%@ Import Namespace="System.Xml" %>
  • <%@ Import Namespace="System.Data" %>
  • <%@ Import Namespace="System.Data.OleDb" %>
  • <script runat=server>
  • private i, j as integer
  • private strOutput as string = ""
  • sub Page_Load(obj as object, e as eventargs)
  • dim xmldoc as new XMLDataDocument()
  • try
  • xmldoc.DataSet.ReadXml(Server.MapPath("film.xml"))
  • DataGrid1.DataSource = xmldoc.DataSet
  • DataGrid1.DataMember = xmldoc.DataSet.Tables(0).TableName
  • DataGrid1.DataBind()
  • catch ex as Exception
  • strOutput = "Impossible d'accéder au fichier XML"
  • end try
  • output.Text = strOutput
  • end sub
  • </script>
  • <html>
  • <body>
  • <asp:Label id="output" runat="server" />
  • <asp:DataGrid id="DataGrid1" runat="server"
  • BorderColor="black"
  • GridLines="Vertical"
  • cellpadding="4"
  • cellspacing="0"
  • width="450"
  • Font-Name="Arial"
  • Font-Size="8pt"
  • HeaderStyle-BackColor="#cc9966"
  • FooterStyle-BackColor="#cccc99"
  • ItemStyle-BackColor="#ffffff"
  • AlternatingItemStyle-Backcolor="#cccccc" />
  • </body>
  • </html>
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script runat=server>
	private i, j as integer
	private strOutput as string = ""
   
   	sub Page_Load(obj as object, e as eventargs)
      	dim xmldoc as new XMLDataDocument()
         
      	try
         	xmldoc.DataSet.ReadXml(Server.MapPath("film.xml"))
         
         	DataGrid1.DataSource = xmldoc.DataSet
         	DataGrid1.DataMember = xmldoc.DataSet.Tables(0).TableName
         
         	DataGrid1.DataBind()
         
        catch ex as Exception
           	strOutput = "Impossible d'accéder au fichier XML"
      	end try
      
      	output.Text = strOutput
	end sub
</script>

<html>
<body>
   <asp:Label id="output" runat="server" />
   
   <asp:DataGrid id="DataGrid1" runat="server" 
         BorderColor="black" 
         GridLines="Vertical" 
         cellpadding="4" 
         cellspacing="0" 
         width="450"
         Font-Name="Arial" 
         Font-Size="8pt" 
         HeaderStyle-BackColor="#cc9966"
         FooterStyle-BackColor="#cccc99"
         ItemStyle-BackColor="#ffffff"
         AlternatingItemStyle-Backcolor="#cccccc" />
</body>
</html>     

 Conclusion

Allez bon courage et bonne programmation !!!!!    

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

COMPOSANT ASPMAIL PILOTÉ VIA SQL SERVER
Source .NET (Dotnet) LISTER LES DOSSIERS D'UN RÉPERTOIRE
Source .NET (Dotnet) LISTER LES FICHIERS D'UN RÉPERTOIRE
Source .NET (Dotnet) INFORMATIONS D'UN FICHIER
Source avec Zip Source .NET (Dotnet) GÉNÉRER UN DOCUMENT HTML À PARTIR DE DONNÉES CONTENUES DANS ...

 Sources de la même categorie

Source avec Zip Source .NET (Dotnet) GUESTBOOK AVEC GRIDVIEW par DanMor498
Source avec Zip CHECKED DROPDOWNLIST par fredzool
Source avec Zip Source avec une capture Source .NET (Dotnet) GRIDVIEW WITH TREEVIEW AND CALLBACK par fredzool
Source avec Zip APPELLER UN WEBSERVICE DEPUIS JAVASCRIPT par fredzool
Source avec Zip Source .NET (Dotnet) MONEY TEXTBOX WITH EMBEDED JAVASCRIPT par fredzool

Commentaires et avis

Commentaire de tripmagic le 07/09/2008 21:00:29

simple et efficace

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 2,808 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales