当前位置:编程学习 > C#/ASP.NET >>

太奇怪了

 为什么只要在页面上点击服务器控件(Button),页面就变成空白了,什么都没有了啊??
是什么原因啊?? --------------------编程问答-------------------- 贴代码看看 --------------------编程问答-------------------- 对,代码呢 --------------------编程问答-------------------- 那要看你onclick时间里写了什么 --------------------编程问答-------------------- 估计你的button是一个form中的submit button. --------------------编程问答-------------------- <head runat="server">
    <title>相同楼盘推案</title>
     <link href="../CSS/BaseCss.css"  type="text/css" rel="Stylesheet" />
      <script language="javascript">
        function compare(obj)
        {
            window.open("SamePeriodDetail.aspx?ItemID="+obj);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ItemID"
            Width="1142px" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging"  PageSize="20" OnRowDeleting="GridView1_RowDeleting1">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <input id="Button1" class="ButtonCss" style="width: 85px" type="button" value="比较"  onclick="compare('<%#DataBinder.Eval(Container.DataItem,"ItemID") %>')"/>
                    </ItemTemplate>
                    <ItemStyle Width="100px" />
                </asp:TemplateField>
                
                 <asp:TemplateField>
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CommandName="delete" OnClientClick="javascript:return confirm('真的要删除该项吗?')">删除</asp:LinkButton>
                    </ItemTemplate>
                     <ItemStyle Width="60px" />
                </asp:TemplateField>
                
                <asp:BoundField DataField="SaleArea" HeaderText="推案量(平方米)" />
                <asp:BoundField DataField="SaleTime" DataFormatString="{0:d}" HeaderText="推案时间" HtmlEncode="False" />
                <asp:BoundField DataField="SaleCount" HeaderText="推案套数" />
                <asp:BoundField DataField="SalePrice" HeaderText="推案价格(元/平方米)" />
                <asp:BoundField DataField="SaleRates" HeaderText="销售率" />
                <asp:BoundField DataField="EditDate" DataFormatString="{0:d}" HeaderText="更新时间"
                    HtmlEncode="False" >
                    <ItemStyle Width="100px" />
                </asp:BoundField>
            </Columns>
        </asp:GridView>
    
    </div>
    </form>
</body>
</html>

-----------------------------------------------------------------------
Home_RentSale_SalePeriod sale;
    protected void Page_Load(object sender, EventArgs e)
    {
        this.check();
        sale = new Home_RentSale_SalePeriod();
        if (!IsPostBack)
        {
            BindData();
        }
    }

    private void BindData()
    {
        DataSet ds = sale.GetSameHomePeriod();
        try
        {
            this.GridView1.DataSource = ds;
            this.GridView1.DataBind();
        }
        catch { }
    }


    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        BindData();
    }


    protected void GridView1_RowDeleting1(object sender, GridViewDeleteEventArgs e)
    {
        this.check();
        sale.ItemID = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
        if (sale.DeleteSameHomePeriod())
        {
            Sys.SaveUserLog(Session["UserName"].ToString(), "删除相同楼盘推案(" + sale.ItemID + ")");
            Message.ShowMessage(this, Message.DeleteSalePeriodSucc);
            BindData();
        }
        else
        {
            Message.ShowMessage(this, Message.DeleteSalePeriodFail);
            return;
        }
    }


--------------------编程问答-------------------- 我什么都没有写的,可就是一点击就没有数据了
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,