我有以下协会网页:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.6.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 300,
modal: true,
buttons: {
Ok : function() {
$(this).dialog( close );
__doPostBack( TreeNew , );
},
Cancel: function() {
$(this).dialog( close );
}
},
close: function() {
;
}
});
});
function ShowDialog() {
$( #dialog ).dialog( open );
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="TreeNew" runat="server" Text="Nuevo" OnClientClick="ShowDialog(); return false;"/>
<asp:Label ID="Message" runat="server"></asp:Label>
<div id="dialog" title="Create new user">
<p id="validateTips">All form fields are required.</p>
<asp:RadioButtonList ID="ContentTypeList" runat="server">
<asp:ListItem Value="1">Text</asp:ListItem>
<asp:ListItem Value="2">Image</asp:ListItem>
<asp:ListItem Value="3">Audio</asp:ListItem>
<asp:ListItem Value="4">Video</asp:ListItem>
</asp:RadioButtonList>
</div>
</div>
</form>
</body>
</html>
当用户点击TreeNew按钮时,模态对话框将出现,然后他/她选择一个选项并单击确定按钮执行回传。
我需要服务器端执行TreeNew_Click方法:我该怎么做?
如果我使用__doPostBack(TreeNew,)它会抛出以下错误:“对象期望”。
UPDATE:
I found the origin for the error: the function __doPostBack is not defined. I m not going to delete the question because I think Chris Clark s answer is so interesting.