am fin ;
fin = new FileStream(Server.MapPath(datafile), FileMode.Open, FileAccess.Read, FileShare.ReadWrite) ;
// Infer the DataSet schema from the XML data and load the XML Data
datadoc.DataSet.ReadXml(new StreamReader(fin));
//Close the stream
fin.Close();
//get the total no of viewers by getting the count of the no of rows present
//in the Table
showtotal.Text ="Total Viewers :"+ datadoc.DataSet.Tables[1].Rows.Count.ToString() ;
//databind the Repeater to the Dataset of table '1' ie the 'Viewer'
MyDataList.DataSource = datadoc.DataSet.Tables[1].DefaultView;
MyDataList.DataBind();
//free the resources
datadoc=null ;
}
catch (Exception ed)
{
//if there is any exception then display it
Response.Write("<font color=#FF0000>An Exception occured "+ed.ToString()+"</font>") ;
}
}
</script>
</head>
<body >
<h4>Welcome to Saurabh's XML Counter Viewing Page.</h4>
<asp:label id="showtotal" text="" runat="server" />
<br>
<ASP:Repeater id="MyDataList" runat="server">
<template name="headertemplate">
<h5> Viewer Details </h5>
</template>
<template name="itemtemplate">
<br>
<table class="mainheads" width="60%" style="font: 8pt verdana" >
<tr style="background-color:#FFFFCC">
<td>Referrer :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Referrer") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>User Agent :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "UserAgent") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>User Host Address :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "UserHostAddress") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>User Host Name :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "UserHostName") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>Browser Type :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "BrowserType") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>Browser Name :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "BrowserName") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>Major Version :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "MajorVersion") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>Minor Version :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "MinorVersion") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>Platform :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Platform") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>Date :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Date") %>
</td></tr>
<tr style="background-color:#FFFFCC">
<td>Time :</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Time") %>
</td>
</tr>
</table><br>
</template>
</ASP:Repeater>
</body>
</html>
上一页 [1] [2]