jQWidgets Forums
Forum Replies Created
-
Author
-
April 19, 2016 at 1:51 pm in reply to: Send ajax data to action in asp.net. Pass parameters Send ajax data to action in asp.net. Pass parameters #83652
Now i am trying and the Controller gets the id. The problem now is that it should redirect to page http://localhost:34558/Listar_DN/Delete/id.
But nothing happens after ajax sends the id to the controller.
Do you know why Dimitar ??
April 19, 2016 at 12:26 pm in reply to: Send ajax data to action in asp.net. Pass parameters Send ajax data to action in asp.net. Pass parameters #83647Ajax call
Controller
April 19, 2016 at 12:20 pm in reply to: Send ajax data to action in asp.net. Pass parameters Send ajax data to action in asp.net. Pass parameters #83645Thanks Dimitar. I am almost done here.
Now my view is like that.
$(“#deleterowbutton”).bind(‘click’, function () {
var rowindex = $(‘#jqxgrid’).jqxGrid(‘getselectedrowindex’);
var dados = $(‘#jqxgrid’).jqxGrid(‘getrowdata’, rowindex);
var rowid = dados.ID;
var id = rowid;$.ajax({
data: JSON.stringify(id),
dataType: ‘json’,
url: “/Listar_DN/Delete/”,
contentType: “application/json; charset=utf-8”,
success: function (result) {
alert = (“Deu certo”);
},
error: function () {
alert(“Nem rolou”);}
})
});$(“#deleterowbutton”).jqxButton();
And my controller like that:
[HttpGet]
public ActionResult Delete(string id)
{
if (id == null)
{
return HttpNotFound();
}var _d = db.diluicao_normal.Find(id);
if (_d == null)
{
return HttpNotFound();
}return View(_d);
}[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Delete(int id)
{try
{
diluicao_normal _d = db.diluicao_normal.Find(id);
db.diluicao_normal.Remove(_d);db.SaveChanges();
}
catch (DataException/* dex */)
{
//Log the error (uncomment dex variable name and add a line here to write a log.
return RedirectToAction(“Delete”, new { id = id, saveChangesError = true });
}
return RedirectToAction(“Index”);
}The ajax call sends a null id to my Controller. Do u know why ??
April 18, 2016 at 5:47 pm in reply to: Send ajax data to action in asp.net. Pass parameters Send ajax data to action in asp.net. Pass parameters #83604I do not need to delete a row. I need to get the id and send to my action to open the delete page.
April 18, 2016 at 5:31 pm in reply to: Send ajax data to action in asp.net. Pass parameters Send ajax data to action in asp.net. Pass parameters #83603Thank you Dimitar. Now makes more sense.
How my button is gonna know that i am calling this function ??
I need the ajax to send the id to my action controller. To open the page localhost:34558/Listar_DN/Delete/15 for example. The id 15 would be the clicked row id.
April 18, 2016 at 11:20 am in reply to: Send ajax data to action in asp.net. Pass parameters Send ajax data to action in asp.net. Pass parameters #83590Come on Guys, need your help. All the other questions in this forum have been responded.
April 14, 2016 at 6:06 pm in reply to: Send ajax data to action in asp.net. Pass parameters Send ajax data to action in asp.net. Pass parameters #83500BTW, the problem is not http://localhost:34558/Listar_DN/Listar_DN/Delete/?31.
I already fixed it. Now is http://localhost:34558/Listar_DN/Delete/?31
The problem is the ? before the number 31.
Thank u Peter for your answer. I did not know the correct name of your product. Sorry about that.
About the grid i would like to add some custom buttons in the footer, close to the paging. Do you guys have an example ?
Thanks for your time.March 23, 2016 at 1:32 pm in reply to: Get row id and send it to my action C# Get row id and send it to my action C# #82770.
March 23, 2016 at 1:14 pm in reply to: Get row id and send it to my action C# Get row id and send it to my action C# #82769Thanks Ivailo
I saw the demo and i have some questions.
Even if my data is coming from the database it works with array???
So is it possible to send row ID in Json to my action controller in C# ??
A friend of mine that is Senior Programmer said is not possible to send data from Json to C#. I am afraid that after 1 week working on it i find out that is not possible.
-
AuthorPosts