0

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?

Community
  • 1
  • 1
marchemike
  • 3,179
  • 13
  • 53
  • 96
  • Check the contents for datatable after the statement is executed in next statement as you have one row. – Adil Jun 19 '14 at 06:15
  • How do I check the datatable? Do I output it in the application or is it possible for me to see it in the console? – marchemike Jun 19 '14 at 06:33

1 Answers1

1

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);
        }
sanepete
  • 979
  • 9
  • 28