드롭 다운 목록 (telerik 드롭 다운 목록)이 있으며 모든 옵션에 대해 내 컨트롤러에서 다른 부분 뷰를 호출합니다.자바 스크립트가있는 부분 뷰
onChange = function (e)
{
var product = e.value;
if (product)
{
$.post(myUrl,
{ CodigoProduto : product }, // passing the product to my controller
function (retorno) {
// insert the partial view in a div
$('#AreaGenerica').html(retorno);
}
);
}
}
첫 번째 옵션은 자바 스크립트 코드를
<script type=\"text/javascript\">
function PartialViewFunction() {
alert("test");
}
</script>
<h2>Option A</h2>
포함하고, 두 번째 옵션은 자바 스크립트 코드가없는 부분 뷰를 리턴하는 부분 뷰를 반환한다. 내보기에서
는 내가 첫 번째 옵션을 선택한 다음 두 번째 'PartialViewFunction가'아직 호출되고 있지만 경우
ViewFunction = function() {
// check if the function 'PartialViewFunction' exists.
if (typeof PartialViewFunction === "function")
{
PartialViewFunction();
}
};
이 이
는 그것이 아무튼 안 내 문제가되어 때문에 그 부분보기 내부의 함수를 호출 두 번째 부분보기 안에 존재하지 않습니다.
answer 다음 부분보기가 포함 된 div를 제거하려고했지만 작동하지 않았습니다.
미리 감사드립니다. 내 영어를 이해할 수 있기를 바랍니다.
편집 : 나는 부분 뷰에서 자바 스크립트를 포함하여 피할 것이다 일반적으로
@(Html.Telerik().DropDownList()
.Name("grpAutorizacaoPublicacao")
.SelectedIndex(0)
.Effects(e => e.Opacity())
.ClientEvents(e =>
{
e.OnChange("onChange");
})
.DataBinding(db => db.Ajax().Select("_ListaGrupoAutorizacao", "Publicador")))
나는 AJAX를 통해 검색된 대화 내용으로 많은 것을 알고있다. 나는 네가 비교할 때 단지 두 개의 '='표지 만 필요로한다고 생각한다. if (typeof initDlg == 'function') initDlg(); – Steve