读书人

ASP.NET指定前台事件执行JS方法异常

发布时间: 2012-10-07 17:28:51 作者: rapoo

ASP.NET指定前台事件执行JS方法错误
前台JS定义:

<script type="text/javascript" src="JavaScript/DataRow.js"language="javascript">

$(window).ready(function()
{
resizeWin();
});

$(window).load(function()
{
resizeWin();
});

$(window).resize(function()
{
resizeWin();

});

function resizeWin()
{
var h = document.documentElement.clientHeight;
$("#frmContent").height(h - 120);
$("#navbarSitMap").height(h - 120);
}

function showDesktop()
{
$("#frmContent")[0].src="~/Desktop.aspx";
return false;
}

function NavbarSitMap_OnItemSelect(sender, eventArgs)
{
if(eventArgs.get_item().getProperty('Url'))
{
document.getElementById('frmContent').src=eventArgs.get_item().getProperty('Url');
}
}

</script>

前台控件定义:

<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="style1">
<CA:NavBar ID="NavbarSitMap" runat="server" AutoPostBackOnSelect ="false" SkinID ="Navbar"
EnableViewState ="true" SiteMapXmlFile ="~/System.xml" Height="50px">
<ClientEvents>
<ItemSelect EventHandler ="NavbarSitMap_OnItemSelect" />
</ClientEvents>
</CA:NavBar>
</td>
<td>
<table border="0" width="100%" cellpadding="0" cellspacing="0"
style="height: 383px">
<tr>
<td>
<iframe id="frmContent" width="100%" src="WebForm2.aspx" scrolling="auto" frameborder="0" cellpadding="0" cellspacing="0">
</iframe>
</td>
</tr>
</table>

</td>
</tr>
</table>
运行时候总提示 NavbarSitMap_OnItemSelect 未定义

[解决办法]
EventHandler ="NavbarSitMap_OnItemSelect" 这个估计是你自定义的方法吧 没有用的话就删除这个吧 要是用的话就在后台添加上试试呢

读书人网 >asp.net

热点推荐