解决方案 »

  1.   

    你表格里有DropDownList 
    后台代码在加载页面的时候肯定是先给DropDownList 绑定数据了
      

  2.   

    带有runat="server" 不能删除,除非你去掉.cs里的所有引用
      

  3.   

    <%@ page language="C#" inherits="zy_right, ydschool_deploy" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>资源列表</title>
        <style type="text/css">
            <!
            -- #show_zy
            {
                position: absolute;
                width: 220px;
                height: 280px;
                z-index: 50;
                left: 0px;
                top: 0px;
                backgroud-color: #ffffff;
                display: none;
                border-width: 2px;
                border-style: solid;
                border-color: #FBC593;
            }
            body
            {
                margin-left: 0px;
                margin-top: 0px;
                margin-right: 0px;
                margin-bottom: 0px;
            }
            -- ></style>
    </head>
    <body>    <script type="text/javascript">
    var n_id;
    function show_up(ty,id,nd)
    {document.getElementById("upinfo").src='zy_upload0.aspx?id='+id+'&type='+ty+'&nd='+nd;}
    function show_zy( id )
    {
    document.getElementById("zyinfo").src='myziyuan_show.aspx?id='+id;
    document.getElementById('show_zy').style.left=(document.documentElement.clientWidth-500)/2;
    document.getElementById('show_zy').style.height=(document.documentElement.clientWidth-700)/2;
    document.getElementById('show_zy').style.display='block';
    }
        </script>    <div id="show_zy">
            <table width="220" height="250" border="0" align="center" cellpadding="0" cellspacing="1"
                bgcolor="#FBC593">
                <tr>
                    <td width="100%" height="25" bgcolor="#FBC593">
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td width="220" align="center">
                                    <font color="black" size="2"><strong>资源详情</strong></font>
                                </td>
                                <td>
                                    <div align="right">
                                        <div align="center">
                                            <span style="cursor: hand" onclick="javascript:document.getElementById('show_zy').style.display='none';">
                                                <font size="2">【×】</font></span></div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td valign="top" bgcolor="#FFFFFF">
                        <iframe id="zyinfo" name="zyinfo" width="220" height="250" frameborder="0" scrolling="no"
                            src=""></iframe>
                    </td>
                </tr>
            </table>
        </div>
        <table width="220" height="400" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td width="188" height="280" valign="top">
                    <div class="ZXWZ">
                        <div>
                            <ul>
                                <%=htm_code%>
                            </ul>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
        <form id="form1" runat="server">    <table>
            <tr>
                <td height="20" align="center" class="gopage">
                    <div id="mypage" runat="server">
                        &nbsp; &nbsp;<asp:hyperlink id="up_page" runat="server" font-size="Smaller">上页</asp:hyperlink>
                        &nbsp;&nbsp;
                        <asp:hyperlink id="next_page" runat="server" font-size="Smaller">下页</asp:hyperlink>
                        &nbsp; &nbsp;
                        <asp:hyperlink id="last_page" runat="server" font-size="Smaller">尾页</asp:hyperlink>
                        &nbsp;&nbsp; <font size="2" color="blue">
                            <%=r_page%></font>&nbsp; /<span style="text-align: left;"><font size="2" color="blue">
                                <%=t_page%></font> &nbsp; &nbsp; <font size="2">页码:
                                    <asp:dropdownlist id="ys" runat="server" autopostback="True" onselectedindexchanged="ys_SelectedIndexChanged"></asp:dropdownlist>
                                </font>&nbsp; &nbsp;<font size="2">每页显示 15 条记录,共有<font color="blue">
                                    <%=r_count %></font> 条记录</font> </span>
                    </div>
                </td>
            </tr>
        </table>
        </form>
    </body>
    </html>
    报什么错,我试了一下,没报错
      

  4.   


    --------------
    “/”应用程序中的服务器错误。
    --------------------------------------------------------------------------------未将对象引用设置到对象的实例。 
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  堆栈跟踪: 
    [NullReferenceException: 未将对象引用设置到对象的实例。]
       zy_right.Page_Load(Object sender, EventArgs e) in d:\ydschool\zy_right.aspx.cs:167
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 
    --------------------------------------------------------------------------------
    版本信息: Microsoft .NET Framework 版本:2.0.50727.5420; ASP.NET 版本:2.0.50727.5420 
      

  5.   

    NullReferenceException 打个断点 看看是那个参数是null
      

  6.   

    很明显Page_Load里先绑定的combobox数据
    你按F5的时候提示你编译出错,你要点"否"看到底哪行代码出错,而不是点"是"让它就那么错误的执行
    或者你按F6编译,看到底哪行出错.
      

  7.   

     System.NullReferenceException
    有变量没初始化。。调试下
      

  8.   

    第一 删除完代码 清理解决方案,重新生成。看报不报错第二用try {} catch{}把代码包起来。
      

  9.   

    这也叫精简?随手删啊!前台控件删掉了,后台代码还在,看看.cs文件里面,难道没有红色波浪线?F5时难道不提示有错误?