About.aspx=>
<%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="About.aspx.cs" Inherits="About" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<div class="infobox" style="width: 700px; margin: 30px auto">
<h2>
User Profile
</h2>
<div class="padding10">
<table cellspacing="0" border="0" cellpadding="8" style="width: 90%">
<tr>
<td align="right" style="width:160px">
Username:</td>
<td>
<asp:Label ID="lblUsername" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
Gender:</td>
<td>
<asp:Label ID="lblSex" runat="server"></asp:Label></td>
</tr>
<tr>
<td align="right">
Age:</td>
<td>
<asp:Label ID="lblAge" runat="server"></asp:Label></td>
</tr>
<tr>
<td align="right">
Location:</td>
<td>
<asp:Label ID="lblLocation" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
Occupation:</td>
<td>
<asp:Label ID="lblOccupation" runat="server"></asp:Label></td>
</tr>
<tr>
<td align="right">
Interests:</td>
<td>
<asp:Label ID="lblInterests" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
Joined:</td>
<td>
<asp:Label ID="lblJoined" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
Last login:</td>
<td>
<asp:Label ID="lblLastLogin" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</div>
</asp:Content>
About.aspx.cs=>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class About : System.Web.UI.Page
{
SqlConnection con;
string s = ConfigurationManager.ConnectionStrings["conn"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
con = new SqlConnection(s);
SqlDataAdapter ad = new SqlDataAdapter("select * from Employees order by EmployeeID", con);
string FirstName = "";
if (this.Request.QueryString["FirstName"] == null)
{
return;
}
FirstName = Request.QueryString["FirstName"];
DataSet ds = new DataSet();
ad.Fill(ds);
if (ds.Tables[0].Rows.Count == 0)
{
return;
}
DataRow row = ds.Tables[0].Rows[0];
this.lblUsername.Text = row["FirstName"].ToString();
this.lblLocation.Text = row["LastName"].ToString();
this.lblOccupation.Text = row["Address"].ToString();
this.lblLastLogin.Text = row["City"].ToString();
this.lblJoined.Text = row["Region"].ToString();
this.lblAge.Text = row["PostalCode"].ToString();
}
}
<%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="About.aspx.cs" Inherits="About" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<div class="infobox" style="width: 700px; margin: 30px auto">
<h2>
User Profile
</h2>
<div class="padding10">
<table cellspacing="0" border="0" cellpadding="8" style="width: 90%">
<tr>
<td align="right" style="width:160px">
Username:</td>
<td>
<asp:Label ID="lblUsername" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
Gender:</td>
<td>
<asp:Label ID="lblSex" runat="server"></asp:Label></td>
</tr>
<tr>
<td align="right">
Age:</td>
<td>
<asp:Label ID="lblAge" runat="server"></asp:Label></td>
</tr>
<tr>
<td align="right">
Location:</td>
<td>
<asp:Label ID="lblLocation" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
Occupation:</td>
<td>
<asp:Label ID="lblOccupation" runat="server"></asp:Label></td>
</tr>
<tr>
<td align="right">
Interests:</td>
<td>
<asp:Label ID="lblInterests" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
Joined:</td>
<td>
<asp:Label ID="lblJoined" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
Last login:</td>
<td>
<asp:Label ID="lblLastLogin" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</div>
</asp:Content>
About.aspx.cs=>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class About : System.Web.UI.Page
{
SqlConnection con;
string s = ConfigurationManager.ConnectionStrings["conn"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
con = new SqlConnection(s);
SqlDataAdapter ad = new SqlDataAdapter("select * from Employees order by EmployeeID", con);
string FirstName = "";
if (this.Request.QueryString["FirstName"] == null)
{
return;
}
FirstName = Request.QueryString["FirstName"];
DataSet ds = new DataSet();
ad.Fill(ds);
if (ds.Tables[0].Rows.Count == 0)
{
return;
}
DataRow row = ds.Tables[0].Rows[0];
this.lblUsername.Text = row["FirstName"].ToString();
this.lblLocation.Text = row["LastName"].ToString();
this.lblOccupation.Text = row["Address"].ToString();
this.lblLastLogin.Text = row["City"].ToString();
this.lblJoined.Text = row["Region"].ToString();
this.lblAge.Text = row["PostalCode"].ToString();
}
}
give he definition of web server,,,
ReplyDelete