Code in aspx.cs file
protected void Page_Load(object sender, EventArgs e)
{
foreach (UserDetail l in liststUser)
{
UserName = l.Name;
Dob = l.dob;
gender = l.gender;
ScriptManager.RegisterStartupScript(this, GetType(), "print User's bio.", " PersonBlockCreator('" + UserName + "','" + Dob + "','" + gender + "');", true);
}
}
Code in .aspx file
<html>
<head>
<script type="text/Javascript">
targetId = "#userData"; //Constant value, please do not modify
BoxName = "box"; //Constant value, please do not modify
j = 0;
function PersonBlockCreator(UserName, Dob, gender) {
$(targetId).append("<div class=" + BoxName + ">" + (j + 1) + "<div class='box-color'><h2>" + sSubjectName + "</h2><h5>"+Dob+"</h5><p>"+gender+" </p></div></div>");
$(".tile").addClass(tileColor);
}
</script>
</head>
<body>
<div class="Box" id="UserData">
//each user data should be printed in an box
//Example:
// --------------- -----------
// | Nethan Walter | | Deen |
// | 10-01-1990 | | 10-01-1990 |
// | Male | | Male |
// --------------- --------------
</div>
</body>
</html>
How can I implement this using JavaScript and C# or solely with C#. My goal is to display a list of user details stored in a listObject in the aspx.cs file on the aspx page when it loads. Currently, only the details of the first user are being displayed, while the rest are being ignored or not printed.