javascript не работает в сетке mvccontrib
<% Html.Grid(Model.InnerModel.ParamaterDetails)
.Empty("No data available")
.Columns(column =>
{
column.For(x => x.MinValue).Named("Possible Min Value");
column.For(x => x.MaxValue).Named("Possible Max Value");
column.For(x => x.ScoreValue).Named("Bespoke Score Value");
column.For(x => "<input type='button' name='button' class='btn' id='editOpenDialog' value='Edit' onclick=javascript:editParametersDialog('" + x.ID + "'); />").DoNotEncode();
}).Render(); %>
<%Html.EndForm(); %>
<script type="text/javascript">
function editParametersDialog(ID) {
// Go back to the server and get the data for the road card timetable
$.ajax({
url: "GetDetails",
type: "POST",
data: "ID=" + ID,
dataType: "json",
success: function(data) {
UpdateEditDialog(data);
$('#addEditDialog').dialog('open');
},
error: function(jqXHR, textStatus, errorThrow) { alert(jqXHR); alert(textStatus); }
});
}
function UpdateEditDialog(data) {
$("#MinValue").val(data.MinValue);
$("#MaxValue").val(data.MaxValue);
$("#ScoreValue").val(data.ScoreValue);
}
$(document).ready(function() {
});
</script>
GetDetails above is in controller
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult GetDetails (int ID)
{
// some code here
}
Вызов onclick javascript:editParametersDialog не работает. Это не вызывается. Любые подсказки, что я могу делать неправильно.
Я могу понять, что javascript:editParametersDialog не превращается в СИНИЙ, что обычно имеет место.
1 ответ
<div id="addEditDialog" ></div>
your code is ok but u didn't put
<div id="addEditDialog"></div>
in the .aspx page.
for show dialog box div tag is must.
$('#addEditDialog').dialog('open');
using this code you say div tag is show as popup.
Do it and try this one again.