views:

161

answers:

2

Hi, I will generate html table dynamically with some textbox and dropdownlist, user will enter their input in that. How to read these data in the controller?(MVC)

A: 

Hi Krish,

There is a relatively quick and easy way to get data from a well-formatted HTML table using the Microsoft .NET Framework Data Provider for OLE DB. Essentially, this allows you to specifiy a connection string which points at the page with your HTML table on it.

Here's an example connection string:

*Provider=Microsoft.Jet.OLEDB.4.0;Data Source=http://www.your_web_address.com/yourHTMLTablePage.htm;Extended Properties="HTML Import;HDR=YES;IMEX=1"*

You can the use the OleDbConnection and OleDbCommand objects to get to the data contained within the table. You can find these inside the namespace: System.Data.OleDb

I hope this helps?

/Richard.

Richard
<form method="post" action=""> <table id="testTable" style="width: 100%;"> <%for (int i = 1; i <= 5; i++) { %> <tr> <td> <input id="textBox1" name="textBox1" type="text" /> </td> </tr> <%} %> </table> <input id="Submit1" type="submit" value="submit" /> </form>This will generate 5 textboxes, i want to read the data entered in these text boxes when i click submit button. Thanks in advance
A: 

This will generate 5 textboxes, i want to read the data entered in these text boxes when i click submit button.

Thanks in advance