TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Schleid Alex
NA
361
48.2k
Help me find the problem
May 26 2020 1:59 PM
@using System.Data
@model DataSet
@{
Layout = null;
}
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<!DOCTYPE html>
<table table-striped >
<tr>
@foreach (DataColumn dc in Model.Tables[0].Columns)
{
<th>
@dc.ColumnName
</th>
}
</tr>
@foreach (DataRow dr in Model.Tables[0].Rows)
{
<tr>
@for (int i = 0; i <= Model.Tables[0].Rows.Count + 1; i++)
{
<td>
@dr[Model.Tables[0].Columns[i]]
</td>
}
</tr>
}
</table>
The above code is supposed to show value from a dataset in a table where I use the column name as table header.
But this is far from showing me the result in a table, I dunno why.
Thank in advance
Alex
Reply
Answers (
3
)
Returning column name from dataset as table header
ASP.NET Core Razor - select from enum shows only value