Advertisement
futog

Default.aspx prvi zadatak

Mar 5th, 2017
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data;
  8. using System.Xml;
  9.  
  10. namespace WebApplication3
  11. {
  12.     public partial class _Default : System.Web.UI.Page
  13.     {
  14.         protected void Page_Load(object sender, EventArgs e)
  15.         {
  16.             prikaziXmlPodatke();
  17.         }
  18.  
  19.         private void prikaziXmlPodatke()
  20.         {
  21.  
  22.             string xmlfajl = HttpContext.Current.Server.MapPath("~/xmlfile1.xml");
  23.  
  24.             DataSet ds = new DataSet();
  25.             ds.ReadXml(xmlfajl);
  26.  
  27.             //Sortiranje fala po citanosti knjige
  28.  
  29.             DataView dv = new DataView(ds.Tables[0]);
  30.             dv.Sort = "MaxTemperatura DESC";
  31.  
  32.             if (ds.Tables[0].Rows.Count > 0)
  33.             {
  34.                 GridView1.DataSource = dv;
  35.                 GridView1.DataBind();
  36.             }
  37.             else
  38.             {
  39.                 Response.Write("Nema podataka za prikaz!");
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement