点击屏幕后,asp.net会自动刷新,不需要的行为

时间:2019-04-17 18:20:22

标签: c# asp.net

如果我单击网页正文中的任意位置,则页面将刷新,因此我正在asp.net项目和一个页面上工作。如果我单击文本框以自动刷新页面的方式编辑该页面,则该页面是一个用于添加和编辑产品的管理区域,该文本框中没有任何内容。仅在此一页上,这在其他任何页面上都不会发生,并且我所看到的没有什么不同会导致这种行为。 在这个问题上的任何帮助将不胜感激 谢谢

我已经查看了其他页面,看看是否存在导致这种现象的差异,而且看起来没有什么不同

内容页面

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">



    <asp:Panel runat="server" class = "ProductList">
        <div id="products">

            <table>
                <thead>
                    <tr>
                        <th>Item ID</th>
                        <th>Brand</th>
                        <th>Item Name</th>
                        <th>image</th>
                        <th>Item Description</th>
                        <th>Price</th>
                        <th>Delete Product</th>
                        <th>Edit Product</th>
                    </tr>
                </thead>
                <asp:Repeater ID="rptAdminProducts" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td><%#Eval ("ItemID") %></td>
                            <td><%#Eval("Brand") %></td>
                            <td><%#Eval("Title") %></td>

                            <td>
                                <img src='data:image/jpg:base64,
                                <%#Eval("ProdImage") != System.DBNull.Value ? 
                                Convert.ToBase64String((byte[])Eval("ProdImage")): String.Empty%> '
                                    alt="Prod image" />
                            </td>

                            <td><%#Eval("ItemDesc") %></td>
                            <td>€  <%#Eval("Price") %></td>
                            <td>
                                <asp:Button runat="server" ID="btnDeleteProduct" OnClientClick="return confirm('Are you Sure you want to delete this Product from the store ?')" CommandArgument='<%# Eval("ItemID") %>' Text="Delete Product From Store" OnCommand="btnDeleteProduct_Command" CommandName="Delete" /></td>
                            <td>
                                <asp:Button runat="server" ID="btnEditProduct" OnClick="btnEditProduct_Click" CommandArgument='<%# Eval("ItemID") %>' Text="Edit Product Details" OnCommand="btnEditProduct_Command" CommandName="Edit" /></td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
        </div>
        <div id ="addNewProductArea">
        <h1>Add Product</h1>


        <asp:Panel runat="server" ID="panelNewProduct">
            <asp:Label runat="server" ID="lblNewProdName" Text="Product Name"></asp:Label>
            <asp:TextBox runat="server" ID="txtNewProdName"></asp:TextBox>

            <br />
            <asp:Label runat="server" ID="lblNewProdBrand" Text="Product Brand"></asp:Label>
            <asp:TextBox runat="server" ID="txtNewProdBrand"></asp:TextBox>
            <br />
            <asp:Label runat="server" ID="lblNewProdDesc" Text="Product Desc"></asp:Label>
            <asp:TextBox runat="server" ID="txtNewProdDesc"></asp:TextBox>
            <br />
            <asp:Label runat="server" ID="lblNewProdPrice" Text="Product Price"></asp:Label>
            <asp:TextBox runat="server" ID="txtNewProdPrice"></asp:TextBox>
            <br />
            <asp:FileUpload ID="fProdImage" runat="server" />
            <br />
            <asp:Button ID="btnUpload" Text="Upload" runat="server" OnClick="btnUpload_Click" />
            <asp:Label runat="server" ID="lblNewProdImage" Text="Upload product"></asp:Label>
        </asp:Panel>
    </div>
    </asp:Panel>
    <div id="EditProducts">
        <h2>Edit Product Area</h2>
        <asp:Panel ID="panEditProduct" runat="server">

            <asp:Label runat="server" ID="lblEditItemId" Text="Item ID"></asp:Label>
            <asp:Label runat="server" ID="lblGetItemID"></asp:Label>
            <br />
           <asp:Label runat="server" ID="lblEditBrand" Text="Product Brand"></asp:Label>
            <asp:TextBox runat="server" ID="txtEditBrand"></asp:TextBox>
            <asp:Label runat="server" ID="lblBrandError"></asp:Label>
            <br />
            <asp:Label runat="server" ID="lblEditTitle" Text="Product Name"></asp:Label>
            <asp:TextBox runat="server" ID="txtEditTitle"></asp:TextBox>
            <br />
            <asp:Label runat="server" ID="lblEditDesc" CssClass= "TextBoxLarge" Text="Product Description"></asp:Label>
            <asp:TextBox runat="server" ID="txtEditDesc"></asp:TextBox>
            <br />
            <asp:Label runat="server" ID="lblEditPrice" Text="Product Price"></asp:Label>
            <asp:TextBox runat="server" ID="txtEditPrice" ></asp:TextBox>
            <br />


            <asp:Button runat="server" ID="btnUpdateItem" Text="Update Product" OnClick="btnUpdateItem_Click" />
        </asp:Panel>
    </div>
</asp:Content>

母版页

<%@ Master Language="C#" AutoEventWireup="true"  CodeBehind="MasterAdmin.master.cs" Inherits="CA4KevinColgan10029059.MasterAdmin" %>


<!DOCTYPE html>

<html>

<head runat="server">
    <title></title>
    <link href="Styles/AdminStyle.css" rel="stylesheet" type="text/css" />

    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">

        <header>
            <img src="images/Logo.png" />


            <nav>
                <ul class="menuarea">
                    <li><a class="navBarLink" href="Default.aspx">Home</a></li>

                    <li><a class="navBarLink" href="Eleiko.aspx">Eleiko Barbells</a></li>
                    <li><a class ="navBarLink" href="SBD.aspx">SBD</a></li>
                    <li><a class ="navBarLink" href="Cart.aspx">Cart</a></li>
                    <li><a class ="navBarLink" href="AdminPage.aspx"</li>
                </ul>
                <div class="cart">

                    <asp:Label runat ="server" ID="lblItems"></asp:Label>
                    <asp:Label runat="server" ID="lblTotal"></asp:Label>
                </div>

            </nav>

        </header>

            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
            <asp:Label ID="lblUser" runat="server"></asp:Label>
        </asp:ContentPlaceHolder>





    </form>
</body>
</html>

0 个答案:

没有答案