1
我用下面的方法彈出一個帶網格的模態,然後將選定的值返回給父節點。這在一個獨立的項目中運行良好,只有一個aspx頁面。jquery返回值
<script>
function openDialog() {
$("#MyModal").dialog('open');
}
function CloseDialog() {
$("#MyModal").dialog('close');
$("input#txtName").val($("input#hdnName").val());
$("input#txtFName").val($("input#hdnFName").val());
$("input#txtLName").val($("input#hdnLName").val());
}
$(document).ready(function() {
$("#MyModal").dialog({ autoOpen: false });
//event can fire on the click of HTML Table
$("#<%=grdModal.UniqueID%> tr").click(function() {
var id = $(this).find("td:nth-child(1)").html();
var Name = $(this).find("td:nth-child(2)").html();
var fName = $(this).find("td:nth-child(3)").html();
var lName = $(this).find("td:nth-child(4)").html();
$("input#hdnId").val(id);
$("input#hdnName").val(Name);
$("input#hdnFName").val(fName);
$("input#hdnLName").val(lName);
});
// Change the Mouse Pointer on grid row hover
$('#<%=grdModal.ClientID%> tr').mouseover(function() {
$(this).css({ cursor: "hand", cursor: "pointer" });
});
</script>
我在gridview中填充了代碼隱藏的虛擬數據表。 現在,當我把它放到我的解決方案中時,它不會將值返回給父項。 任何線索?我在解決方案中粘貼了相同的代碼。
「回到父母」是什麼意思?這是所有網頁,無論你如何使用jQuery進行視覺更改。如果你刪除了jquery,該頁面是否工作? – Dave 2011-02-24 14:26:17