我的 DetailsView 上方有一个按钮。当我单击它时,它将弹出一个“插入注释”对话框(iframe 中的另一个页面),此对话框使用 Jquery。我不知道如何在对话框弹出窗口中将记录 ID 传递给这个插入页面。
jQuery代码:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.ui/1.8.6/jquery-ui.min.js"></script>
<link type="text/css" rel="Stylesheet" href="http://ajax.microsoft.com/ajax/jquery.ui/1.8.6/themes/smoothness/jquery-ui.css">
<script type="text/javascript">
$(document).ready(function () {
$('#AddNewProposal').live('click', function (e) {
e.preventDefault();
var page = $(this).attr("href")
//var page = "ProposalCreateNew.aspx"
var pagetitle = $(this).attr("title")
alert(page);
var $dialog = $('<div></div>')
.html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%" frameBorder="0" align="middle"> ></iframe>')
.dialog({
autoOpen: false,
modal: true,
height: 650,
width: 900,
title: pagetitle
});
$dialog.dialog('open');
});
});
</script>
我已经尝试过了,但它给出了错误“服务器标签不能包含 <% ... %>”
<table width="80%" align="center" >
<tr>
<td width="20%"></td>
<td width="80%" class="PageTitle"></td>
<td width="20%">
<asp:Button runat="server" CommandName="AddNewProposal" ID="AddNewProposal" Text="Create New" href="ProposalCreateNote.aspx" title="Create Note" class="button3"/>
</td>
</tr>
</table
--- Below is my DetailsView which has a label to display the ProposalID, so I want to grab this ID and pass it to the dialog box (URL + ID) when I click the AddNewProposal button.
<asp:TemplateField HeaderText="ProposedID" SortExpression="Name" >
<ItemTemplate >
<asp:Label ID="ProposalID" runat="Server"
style="text-align:left;" Text='<%# Eval("ProposedID")%>' />
</ItemTemplate>
</asp:TemplateField>
请帮忙。提前致谢。