C# 获取要在asp.net中的aspx页面上显示的动态数据
我使用下面的代码来显示用户的个人资料信息,但是你可以看到它的静态数据,因此我必须为每个人分别创建页面数C# 获取要在asp.net中的aspx页面上显示的动态数据,c#,asp.net,C#,Asp.net,我使用下面的代码来显示用户的个人资料信息,但是你可以看到它的静态数据,因此我必须为每个人分别创建页面数 <td valign="top" class="main_text" > <h1>Attendance Dashboard</h1> <table cellspacing="0" cellpadding="0" border="0"
<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>
考勤仪表板
姓名:乌斯曼·阿卜杜拉
性别:男
系:计算机科学学士
职务:学生
电话:0333-1234567
是否有人可以指定一种方式,以便在访问特定用户的配置文件时,我可以直接从数据库中插入这些值?
<h3 style="display:inline;">Name:</h3> <h4 style="display:inline;" >Usman Abdullah</h4>
您使用的是ASP.Net还是经典ASP?它们完全不同。asp.net,对此表示抱歉。我不知道我会猜(所以不是答案)你在使用asp.net,在这种情况下,你应该看看数据绑定和。
<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..