0

我的asp项目有一个非常奇怪的问题。当我在本地主机上测试时,我的项目可以顺利运行。但是当我部署到服务器时

它给了我这个错误

        ApplicationException: Object reference not set to an instance of an object.]
       LewreERP_MixsolProject.Module.Sales.SalesOrder.SalesOrderListing.createGridView() in C:\Users\user\Desktop\30052012\LewreERP_MixsolProject\Module\Sales\SalesOrder\SalesOrderListing.aspx.cs:309
       LewreERP_MixsolProject.Module.Sales.SalesOrder.SalesOrderListing.Page_Load(Object sender, EventArgs e) in C:\Users\user\Desktop\30052012\LewreERP_MixsolProject\Module\Sales\SalesOrder\SalesOrderListing.aspx.cs:148
       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) +91
       System.Web.UI.Control.LoadRecursive() +74
       System.Web.UI.Page.ProcessRequestMain(Boole

an includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

这是我的后端编码

protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        if (!Page.IsPostBack)
        {

        }


    }
    catch (Exception ex)
    {
        logger.Error(ex.Message);
        throw;
    }
}

private void assignCmdBtn()
{
    //if (hfListStatus.Value == gbcSalesOrder.SNew)
    //{

    //}
    //else
    //{

    //}



}







protected void btnSearch_Click(object sender, EventArgs e)
{
    try
    {


    }
    catch (Exception ex)
    {
        logger.Error(ex.Message);
        throw;
    }
}

protected void btnSearchClear_Click(object sender, EventArgs e)
{
    try
    {


    }
    catch (Exception ex)
    {
        logger.Error(ex.Message);
        throw;
    }
}

protected void imgBtnLeft2_Click(object sender, ImageClickEventArgs e)
{


}

protected void ingBtnRight2_Click(object sender, ImageClickEventArgs e)
{

}

protected void ddlRowPerPage_SelectedIndexChanged(object sender, EventArgs e)
{

}

protected void btncAdd2_Click(object sender, EventArgs e)
{


}

protected void btncDelete_Click(object sender, EventArgs e)
{

}

protected void imgBtnLeft_Click(object sender, ImageClickEventArgs e)
{

}

protected void ingBtnRight_Click(object sender, ImageClickEventArgs e)
{

}

protected void btnGvPage2_Click(object sender, EventArgs e)
{

}

protected void btnGvPage_Click(object sender, EventArgs e)
{

}

protected void lnkNew_Click(object sender, EventArgs e)
{

}



protected void btncAdd_Click(object sender, EventArgs e)
{


}


protected void gvSaleOrder_RowCommand(object sender, GridViewCommandEventArgs e)
{

}

protected void gvSaleOrder_RowDataBound(object sender, GridViewRowEventArgs e)
{

}




protected void lnkCancel_Click(object sender, EventArgs e)
{

}



protected void lnkConfirmed_Click(object sender, EventArgs e)
{
}

protected void lnkPartialShip_Click(object sender, EventArgs e)
{

}

protected void lnkFullyShip_Click(object sender, EventArgs e)
{

}

protected void lnkComplete_Click(object sender, EventArgs e)
{

}

private void countTotalItem()
{


}



//Refresh all the page status
protected override void OnPreRender(EventArgs e)
{
    try
    {



    }
    catch (Exception ex)
    {
        logger.Error(ex.Message);
        throw;
    }
}

我的前端

   <%@ Page Title="" Language="C#" MasterPageFile="~/Module/SharedPage/ProjectManagement.master"
    AutoEventWireup="true" CodeBehind="SalesOrderListing.aspx.cs" Inherits="LewreERP_MixsolProject.Module.Sales.SalesOrder.SalesOrderListing" %>

<%@ Register Assembly="LewreERP_MixsolProject" Namespace="blcCustomControl" TagPrefix="cc1" %>
<%@ Register Src="../../SharedPage/Master/messageAlertUC.ascx" TagName="messageAlertUC"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageTitle" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageContent" runat="server">

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <table style="width: 100%">
            <tr>
                <td class="titleContainer">
                    <table class="table100">
                        <tr>
                            <td class="icon">
                                <asp:Image ID="Image2" runat="server" ImageUrl="~/Styles/images/icon04.gif" />
                            </td>
                            <td class="title">
                                Sales Order
                            </td>
                            <td class="tableAlignRight">
                                <span class="titleSpecialHelp"><a href="">Need Help?</a></span> <span class="titleSpecialHelp">
                                    |</span> <span class="titleSpecialHelp"><a href="">Printable View</a></span>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="rightColumnModule1">
                    <table width="100%">
                        <tr>
                            <td class="rightColumnModule2DetailColon" style="width: 10%">
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr class="rightColumnModule2">
                <td class="rightColumnModule2TitleContainer">
                    <table class="rightColumnModule2Table">
                        <tr>
                            <td>
                                &nbsp;</td>
                            <td class="tableAlignRight">
                                &nbsp;<asp:LinkButton ID="lnkNew" runat="server" OnClick="lnkNew_Click">New</asp:LinkButton>
                                &nbsp;&nbsp;|
                                <asp:LinkButton ID="lnkConfirmed" runat="server" OnClick="lnkConfirmed_Click">Confirmed</asp:LinkButton>
                                &nbsp;|
                                <asp:LinkButton ID="lnkPartialShip" runat="server" OnClick="lnkPartialShip_Click"> Partial Shipped</asp:LinkButton>
                                &nbsp;|
                                <asp:LinkButton ID="lnkFullyShip" runat="server" OnClick="lnkFullyShip_Click">Fully Shipped</asp:LinkButton>
                                &nbsp;|
                                <asp:LinkButton ID="lnkComplete" runat="server" OnClick="lnkComplete_Click">Completed </asp:LinkButton>
                                &nbsp;|
                                <asp:LinkButton ID="lnkCancel" runat="server" OnClick="lnkCancel_Click"> Cancelled</asp:LinkButton>
                                &nbsp;|
                              <%--  <asp:LinkButton ID="lnkDelete" runat="server" OnClick="lnkDelete_Click">Delete</asp:LinkButton>
                                &nbsp;--%>
                               <asp:LinkButton ID="lnkTotal" runat="server" OnClick="lnkTotal_Click" 
                                    Visible="False">Total List</asp:LinkButton>
                                &nbsp;&nbsp;&nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td class="tableAlignRight">
                                <asp:Panel ID="Panel5" runat="server" DefaultButton="btnSearch">
                                    &nbsp;&nbsp;&nbsp;</asp:Panel>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr class="rightColumnModule2">
                <td class="rightColumnModule2Content">
                    <asp:Panel ID="pnPageTextInput0" runat="server" HorizontalAlign="Right" Height="31px"
                        DefaultButton="btnGvPage2">
                        <table style="width: 100%">
                            <tr>
                                <td style="height: 26px" align="left">
                                    &nbsp;</td>
                                <td style="height: 26px">
                                    /<asp:Button ID="btnGvPage2" runat="server" BorderStyle="None" Height="18px" OnClick="btnGvPage2_Click"
                                        Width="36px" Style="display: none" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                        </table>
                        <br />
                    </asp:Panel>
                    <asp:Panel ID="pnPageTextInput" runat="server">
                    </asp:Panel>
                    <asp:Panel ID="pnAccessLevel" runat="server" HorizontalAlign="Center" DefaultButton="btnGvPage">
                        <table style="width: 100%">
                            <tr>
                                <td style="height: 14px">
                                </td>
                                <td style="height: 14px">
                                </td>
                            </tr>
                            <tr>
                                <td width="33.3%">
                                </td>
                                <td width="33.3%">
                                    &nbsp; &nbsp;</td>
                                <td align="right" width="33.3%">
                                    /<asp:Button ID="btnGvPage" runat="server" BorderStyle="None" Height="18px" OnClick="btnGvPage_Click"
                                        Width="36px" Style="display: none" />
                                </td>
                            </tr>
                        </table>
                        &nbsp;</asp:Panel>
                </td>
            </tr>
        </table>
        <div class="rightColumnModule2">
            <!-- end of rightColumnModule1 -->
            <!-- end of rightColumnModule2 -->
        </div>
    </ContentTemplate>
</asp:UpdatePanel>

我非常确定我已经删除了一个函数名createGridView()并且我还注释了 pageLoad 方法中的所有函数。

我尝试清除并重建解决方案,但仍然保留相同的错误。请帮忙 。谢谢

4

1 回答 1

1

线

你调用的对象是空的

告诉您程序中的变量之一是null.

线

LewreERP_MixsolProject.Module.Sales.SalesOrder.SalesOrderListing.createGridView() 在 C:\Users\user\Desktop\30052012\LewreERP_MixsolProject\Module\Sales\SalesOrder\SalesOrderListing.aspx.cs:309

告诉您源代码中的哪一行有一个值为空的变量。

很可能问题不在于您不再在 localhost 上运行,而是在此新服务器上采用不同路径的代码或数据库中的数据不同。

更新

在您的评论中,您说您已经删除了createGridView(). 但是,该功能显然是在服务器上运行的。

这意味着您没有在服务器上运行最新的代码。

于 2012-07-06T03:59:07.250 回答