0

I wrote an application to mvc 4. I need to report on the specified parameters displayed in a separate tab rather than the current page. Can anybody help me? This is parts of my code

View:

 <table  border="1"> 
    <thead> 
    <tr> 

        <th>C1</th>
        <th>C2</th>
        <th>C3</th> 

    </tr> 
    </thead>         
    <tbody> 
    @foreach (DataRow row in Model.Rows)
    {         
        <tr> 
        @foreach (DataColumn col in Model.Columns)
        {              
            <td>@row[col.ColumnName]</td> 
        }         
        </tr> 
    }     
    </tbody> 
</table>
}
</div>

Controller:

using (SqlConnection connection = new SqlConnection(connectionString))


               {
                    SqlCommand cmd = new SqlCommand(commandText, connection);
                    connection.Open();
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {

                        DataTable myTable = new DataTable();
                        myTable.Load(reader);
                        return View(myTable);

                    }
                }
Ivan_47
  • 463
  • 1
  • 5
  • 18
  • 2
    @user..why not use Jquery UI tabs. jquery fits perfectly with asp.net mvc.. – Sai Avinash Feb 24 '14 at 08:13
  • You can define sections in `layout.cshtml` file and then refer them in the corresponding views where you want to show tabs and try and use `Jquery UI` tabs. – Aritra B Feb 24 '14 at 08:58
  • No, i need to output table on a different page – Ivan_47 Feb 24 '14 at 08:59
  • The above comment remains valid irrespective of the view. Incase, if you want to show tabs, then one of the ways out is by defining `sections` in your `layout` so that you have the option of both showing or not showing tabs(whichever is suitable) in certain views which share the same `layout`. – Aritra B Feb 24 '14 at 09:05
  • ..and if you want to show tabular data, like in `grids`, use whichever you find suitable..there are many options available - `webgrid`, `Jquery datatables`, `JqGrid` etc. – Aritra B Feb 24 '14 at 09:07

0 Answers0