<%@ Page Language="C#" AutoEventWireup="true" CodeFile="menu.aspx.cs" Inherits="menu" %>
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <style type="text/css">
    body
    {
        background-color:#5F8CCC;
        font:12px 宋体;
margin:0 0 0 0;
}
    .Menu00{
    font-family:"宋体", "System";
    font-size: 12px;
    cursor:hand;
    height:23px;
    background-color:#5F8CCC;
    }
    .Menu01{
    font-family:"宋体", "System";
    color:#ffffff;
    font-size: 12px;
    cursor:hand;
    height:23px;
    background-color:#73AAF9;
    }
    .Menu10{
    font-family:"宋体", "System";
    font-size: 12px;
    cursor:hand;
    height:20px;
    background-color:#B1CAEF;
    }
    .Menu11{
    font-family:"宋体", "System";
    color:#ffffff;
    font-size: 12px;
    cursor:hand;
    height:20px;
    background-color:#73AAF9;
    }
    .Menuline{
     border-top:1px solid #000000;
    }
</style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
 
    <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">        <ContentTemplate>
            <ajaxToolkit:Accordion ID="Accordion_menu" runat="server" Width="140px" Height="100%" OnItemDataBound="Accordion_menu_ItemDataBound" FadeTransitions="true" SuppressHeaderPostbacks="true">
                <HeaderTemplate>
                    <table width="140px" border="0" cellpadding="0" cellspacing="0">
                        <tr onMouseOver="this.className='Menu01'" onMouseOut="this.className='Menu00'" class="Menu00">
                            <td class="Menuline">
                                <asp:HiddenField ID="HiddenField_fsno" runat="server" Value='<%#Eval("fk_no")%>' />
                                &nbsp;&nbsp;<%#Eval("fk_name")%>
                            </td>
                        </tr>
                    </table>
                </HeaderTemplate>
                <ContentTemplate>
                    <asp:Repeater ID="Repeater_functionlist" runat="server">
                        <HeaderTemplate>
                           <table width="140px" border="0" cellpadding="0" cellspacing="0">
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr onClick="window.open('<%#Eval("fl_file")%>?Power=<%#Eval("fl_no")%>&TimeID='+Math.random(),'mainFrame','')" onMouseOver="this.className='Menu11'" onMouseOut="this.className='Menu10'" class="Menu10">
                                <td width="140px" height="20px" class="Menuline">
                                    <asp:HiddenField ID="HiddenField_flno" runat="server" Value='<%#Eval("fl_no")%>' />
                                    &nbsp;&nbsp;&nbsp;&nbsp;<%#Eval("fl_name") %>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            </table>
                        </FooterTemplate>
                    </asp:Repeater>
                </ContentTemplate>
            </ajaxToolkit:Accordion>
            <table width="140px" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="140px" height="1px" class="Menuline">&nbsp;</td>
                </tr>
            </table>
        </ContentTemplate>
               </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
 public partial class menu : System.Web.UI.Page
{
    int fk_no = 0, ep_no;
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            ep_no = Convert.ToInt32(Session["login"].ToString());
        }
        catch
        {
            ep_no = 0;
        }
        if (!Page.IsPostBack)
        {
            
            try
            {
                kjjdb1.Open();
                
                bindkind();
            }
            finally
            {
                kjjdb1.Close();
            }
        }
    }    private void bindkind()
    {
        Accordion_menu.DataSource = kjjdb1.getfunctionkind();
        Accordion_menu.DataBind();
        kjjdb1.drclose(Accordion_menu.DataSource);
    }    private void bindlist(int fk_no, Repeater rp)
    {
        try
        {
            kjjdb1.TOpen();
            rp.DataSource = kjjdb1.getfunctionlist(fk_no);
            rp.DataBind();
            kjjdb1.drclose(rp.DataSource);
        }
        finally
        {
            kjjdb1.TClose();
        }
    }    protected void Accordion_menu_ItemDataBound(object sender, AjaxControlToolkit.AccordionItemEventArgs e)
    {
        if (e.ItemType == AjaxControlToolkit.AccordionItemType.Header)
        {
            HiddenField HiddenField_temp=(e.AccordionItem.FindControl("HiddenField_fsno") as HiddenField);
            fk_no = Convert.ToInt32(HiddenField_temp.Value);
        }
        else if (e.ItemType == AjaxControlToolkit.AccordionItemType.Content)
        {
            Repeater Repeater_temp = (e.AccordionItem.FindControl("Repeater_functionlist") as Repeater);
            bindlist(fk_no, Repeater_temp);
        }
    }    
}
以上是我的一个老系统的菜单代码,年前都是运行的好好的,这些天重新装了系统,然后当我在IE运行这个系统,并且点击 Accordion 的 HeaderTemplate时候,会出现126行找不到对象的JS脚本错误,很奇怪,但是我在火狐运行的时候,却是运行的好好的,搞了我一天了。请问高手,这究竟是什么问题?

解决方案 »

  1.   

    webconfig的  <system.web>节加入:<httpHandlers>
          <remove verb="*" path="*.asmx"/>
          <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions,Version=1.0.61025.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35"/>
          <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions,Version=1.0.61025.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35"/>
          <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler,System.Web.Extensions,Version=1.0.61025.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35" validate="false"/>
        </httpHandlers >
      

  2.   

    上面一段有的,本来就是个ajax网站。。
    我刚才脚本调试了一下,发现问题在125行的红字部分,但是其他的机器以及不同的浏览器却是可以运行的,高手来解答啊。。....
    this._headersSize = this._getHeadersSize().height;var original = pane.content._original;switch (this._autoSize) {
    case AjaxControlToolkit.AutoSize.None :
    original.style.height = 'auto';original.style.maxHeight = '';break;case AjaxControlToolkit.AutoSize.Limit :
    var remaining = this._getRemainingHeight(false);original.style.height = 'auto';original.style.maxHeight = remaining + 'px';break;case AjaxControlToolkit.AutoSize.Fill :
    var remaining = this._getRemainingHeight(true);original.style.height = remaining + 'px';original.style.maxHeight = '';break;} 
    },
    _onHeaderClick : function(evt) {
    var header = evt.target;var accordion = this.get_element();while (header && (header.parentNode !== accordion)) {
    header = header.parentNode;}
    evt.stopPropagation();if (this._suppressHeaderPostbacks) {
    evt.preventDefault();}
    var index = header._index;if ((index === this._selectedIndex) && !this._requireOpenedPane) {
    index = -1;}
    .....
      

  3.   

    调试显示 header._index为null...
      

  4.   

     
    确实有难题待解决
     先把这解决了,,你就是高人
    http://topic.csdn.net/u/20090223/16/aaaed7b2-3808-4ad7-8224-5520575ae56a.html
      

  5.   

    会不会你的AjaxControlToolkit版本不一样?
      

  6.   

    现在可以大致确定的一点是,重新装了系统后,可能在ajax的版本之类的事情下出了某些事情,现在某些第三方控件,比如FCKeditor在本机上也是失效,但是在另外的机器上却是可以的。
      

  7.   

    通过ghost恢复后,这个问题不再出现,结贴