net mvc 5 and have a view "Search.cshtml" and a controller "HomeController" and a model "user".
I try to create a DataTable out of Active Directory and show this in a table in the view.
I can show the table in the view but i want to implement a search textfield for selection a value in this table.
For this I create a method for testing and have the Method in my controller:
public ActionResult Search(string searchString){
var data = GetTable(searchstring);
return View(data);
}
static DataTable GetTable(string data){
//...here i get data from the active Directory and filter with data parameter
}
And here is my View
<h2>Suchen</h2>
@using(HTML.BeginForm()){
@Html.TextBox("SearchString")
<input type="submit" value="Suchen">
<table>
<thead>
<tr>
@foreach(DataColumn col in MOdel.Columns){
<th>@col.ColumnName</th>
}
</tr>
</thead>
<tbody>
@foreach(DataRow col in Model.Rows){
<tr>
@foreach(DataColumn col in Model.Columns){
<td>@row[col.columnName]</td>
}
</tr>
}
</tbody>
</table>
}
How I can post my SearchString to my Controller and then I know wht i must do ;)
searchString(LowerCases)