Witajcie,
Mam problem z ajax'em i action link. Niestety po kliknieciu na link, zamiast uaktualnic div, przekierowuje mnie bezposrednio do "view" funkcji.
@model IEnumerable<GridViewTest.Models.TabelaModel>
<script src="~/Scripts/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
<div id="tabela">
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.Druzyna)
</th>
<th>
@Html.DisplayNameFor(model => model.LiczbaMeczy)
</th>
<th>
@Html.DisplayNameFor(model => model.LiczbaGoliStrzelonych)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Druzyna)
</td>
<td>
@Html.DisplayFor(modelItem => item.LiczbaMeczy)
</td>
<td>
@Html.DisplayFor(modelItem => item.LiczbaGoliStrzelonych)
</td>
<td>
@Ajax.ActionLink("Edit", "Edit", new { id=item.ID }, new AjaxOptions() {HttpMethod = "GET", UpdateTargetId = "tabela", InsertionMode = InsertionMode.Replace})
</td>
</tr>
}
</table>
</div>
Kontroler:
public ActionResult Index()
{
string grupa = "a";
if (TempData["grupa"] != null)
{
grupa = TempData["grupa"].ToString();
}
else
{
grupa = "B";
}
string query = "Select * From LigaMistrzowGrupy where Grupa = @Grupa";
List<TabelaModel> tabela = tabelaFunckje.wczytajTabele(query, grupa).ToList();
return View(tabela);
}
[HttpGet]
public PartialViewResult Edit()
{
return PartialView("_GridViewTabelaEdit");
}
Czy bylby ktos w stanie powiedziec mi, dlaczego tak sie dzieje ?. Gdzie popelniam blad ?.