我有一个带有PopulateOnDemand选项的TreeView控件。每次触发TreeNodePopulate事件后,我都需要调用一个javascript函数。 我已经试过这在asp.net后运行javascript函数TreeView TreeNodePopulate事件
后面的代码:
protected void tvMyTree_PopulateNode(object sender, TreeNodeEventArgs e)
{
TreeManager.PopulateNodes(e.Node.Value);
ClientScript.RegisterStartupScript(this.GetType(),"ScriptInitButtons", "InitButtons();", true);
}
JS:
<script type="text/javascript">
function InitButtons() {
$(".folder").button();
$(".folder").click(function() {
createFolderDialog.data('parentID', $(this).attr('id')).dialog('open');
});
$(".leaf").button();
}
</script>
不过的RegisterStartupScript不工作。函数调用不会添加到页面中。