我使用以下代码显示用户的个人资料信息,但是因为你可以看到它的静态数据,因此我必须为每个人单独创建页数。
<td valign="top" class="main_text" >
<h1>Attendance Dashboard</h1>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td></br></br>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td>
<h3 style="display:inline;">Name:</h3> <h4 style="display:inline;" >Usman Abdullah</h4>
</td>
</tr>
<tr>
<td>
<h3 style="display:inline;">Gender:</h3> <h4 style="display:inline;" >Male</h4>
</td>
</tr>
<tr>
<td>
<h3 style="display:inline;">Department:</h3> <h4 style="display:inline;" >BS Computer Science</h4>
</td>
</tr>
<tr>
<td >
<h3 style="display:inline;">Designation:</h3> <h4 style="display:inline;" >Student</h4>
</td>
</tr>
<tr>
<td>
<h3 style="display:inline;">Number:</h3> <h4 style="display:inline;" >0333-1234567</h4>
</td>
</tr>
</table>
</td>
<td width="400px" align="center">
<BR/><BR/>
<img src="css/images/profile_pic.jpg">
</td>
</tr>
任何人都可以指定一种方式,以便在访问特定用户的个人资料时可以直接从数据库插入这些值吗?
答案 0 :(得分:0)
而不是这个
<h3 style="display:inline;">Name:</h3> <h4 style="display:inline;" >Usman Abdullah</h4>
这样做
<h3 style="display:inline;">Name:</h3> <h4 style="display:inline;" ><asp:Literal ID="lblName" runat="server" /></h4>
通过
后面的代码填充数据 /*
* When you access an user profile like www.yoursite.com/user.aspx?userId=3
* You must get the parameter "userId=3" and search in database for the user with ID = 3
* and return an object with its data
*/
User user = GetUserFromDatabase(Int32.Parse(Request["userId"]));
/*
* And put dynamically in the page like
*/
lblName.Text = user.Name;
lblDepartment.Text = user.Department;
//and go on..