Reputation: 3277
I'm fairly new to ASP.NET and I'm trying to save a specific data from my datatable to a hiddenfield.
I am calling my datatable thru this command:
SomeDetails = SomeViewBLL.GetDetails(data1.Value, Data2.Value);
I want to see the output of the SomeDetails variable in my console. I have tried using this tutorial:
How can I easily view the contents of a datatable or dataview in the immediate window
But it says null. However when I check my row count, it shows that it has 1 row.
Is there another way for me to see the contents of my datatable?
Upvotes: 0
Views: 2516
Reputation: 1128
Iterate through the Table and code the console writing:
for (int i = 0; i < SomeDetails.Rows.Count; i++)
{
string row = "";
for (int j = 0; j < SomeDetails.Columns.Count; j++)
{
row += SomeDetails.Rows[i][SomeDetails.Columns[j].ColumnName].ToString() + " - ";
}
System.Diagnostics.Debug.WriteLine(row);
}
Upvotes: 1