I am working with entity frame work to insert data into data base for that I write a web method and query function but data can’t insert data base following my function and web method.
method.
/////////////////////////
function AddGridviewData() {
var AddRow = new Array();
$('[id*=Test_gridview]').find('tr:has(td)').each(function () {
var NewRow = {};
NewRow. name = $(this).find("td:eq(1)").html();
AddRow.push(NewRow);
});
$.ajax({
type: 'POST',
url: "TestPage.aspx/SaveGridViewRowData",
data: '{AddRow: ' + JSON.stringify(AddRow) + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert("Data scessfully saved ");
return false;
}
});
return false;
};
My WebMethod.
public partial class Detail
{
public string Name { get; set; }
}
[System.Web.Services.WebMethod]
public static void SaveGridViewRowData(List<Detail> AddRow)
{
using (var db = new TestEntities()/////////////My Entity Frame work name
foreach (Detail NewRow in AddRow)////Detail class name///
{
db.StoredProcedure1(
NewRow.CurrencyName
);
}
}
There are no eeror and no insert the data into data base.Please help me to solve it.