I am attempting to send the information from my dynamically populated table to the controller.
<tbody>
@if (ViewBag.data != null)
{
foreach (var item in ViewBag.data)
{
<tr>
<td class="AutoId">@item.AutoID <input type="hidden" name="AutoID" value="@item.AutoID" /></td>
<td class="hove" name="text"><a href="#"> <b>@item.Text</b></a><br /><label></label></td>
<td class="Active">@item.Active</td>
<td id="oBy" name="OrderBy">@item.OrderBy</td>
</tr>
}
}
This is the layout of the table.
For transferring a single field, I am implementing an ajax call as shown below...
<script>
$(document).ready(function () {
alert("Test 1");
$("#btnSave").click(function (e) {
alert("Test 2");
$.ajax({
type: "POST",
url: '@Url.Action("LookupManagementUpdate", "Admin", new { Area = "Admin" })',
data: $(".hove").val(),
dataType: 'json',
async: false,
success: function (response) {
Success = true;
},
error: function (response) {
},
});
});
});
</script>
Here is the code snippet for my controller:
public string LookupManagementUpdate(string text)
{
return "answer"+Request["text"]+text;
}
I have tried fetching the data using both Request and parameter methods, but it does not display the table data. This project is based on C#, MVC, and ADO.NET.