Code Behind Page Page /Admin/Log.aspx.cs (C#)
Used by Page /Admin/Log.aspx (C#)
1: using System;  
2: using System.Data;  
3: using System.Configuration;  
4: using System.Collections;  
5: using System.Web;  
6: using System.Web.Security;  
7: using System.Web.UI;  
8: using System.IO;  
9: using System.Net;  
10: using System.Web.UI.WebControls;  
11: using System.Web.UI.WebControls.WebParts;  
12: using System.Web.UI.HtmlControls;  
13: using System.Data.SqlClient;  
14: using System.Globalization;  
15: using QuizNetOnline.Logic;  
16: using QuiznetOnline.Data;  
17:   
18: public partial class Admin_Log : System.Web.UI.Page  
19: {  
20:     protected void Page_Load(object sender, EventArgs e)  
21:     {  
22:         DataFunctions dataFunctions = DataFunctions.GetInstance();  
23:         SqlDataSource1.ConnectionString = dataFunctions.GetConnectionString();  
24:         SqlDataSource2.ConnectionString = dataFunctions.GetConnectionString();  
25:         //this.SqlDataSource1.ConnectionString = ConnectionObj.GetConnection().ConnectionString;  
26:         //this.SqlDataSource2.ConnectionString = ConnectionObj.GetConnection().ConnectionString;  
27:   
28:     }  
29:     protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)  
30:     {  
31:         IPAddress myIP = IPAddress.Parse(GridView1.SelectedRow.Cells[2].Text);  
32:   
33:         try  
34:         {  
35:             IPHostEntry GetIPHost = Dns.GetHostEntry(myIP);  
36:             WebResponseLabel.Text = "Host Name is: " + GetIPHost.HostName;  
37:         }  
38:         catch(Exception ex)  
39:         {  
40:             WebResponseLabel.Text = ex.Message;  
41:         };  
42:     }  
43:     protected void cmdClear_Click(object sender, EventArgs e)  
44:     {  
45:         Log log=new Log();  
46:         log.ClearLog();  
47:   
48:         this.SqlDataSource1.DataBind();  
49:         this.GridView1.DataBind();  
50:   
51:         this.SqlDataSource2.DataBind();  
52:         this.GridView2.DataBind();  
53:     }  
54:   
55:     protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)  
56:     {  
57:         CultureInfo culture = CultureInfo.InvariantCulture;  
58:   
59:         if (e.Row.RowType == DataControlRowType.DataRow)  
60:         {  
61:   
62:             e.Row.Cells[1].Text = Convert.ToDateTime(e.Row.Cells[1].Text).ToString(culture);  
63:         }  
64:     }  
65: }  

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.