重复值表gridview

时间:2014-08-11 08:11:39

标签: c# asp.net gridview

我试图在gridview中使用表格,但我遇到了问题。

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication4.WebForm1" %>

<!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 id="Head1" runat="server">
    <title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
    $("[src*=plus]").live("click", function () {
        $(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
        $(this).attr("src", "images/minus.png");
    });
    $("[src*=minus]").live("click", function () {
        $(this).attr("src", "images/plus.png");
        $(this).closest("tr").next().remove();
    });
</script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false" CssClass="Grid" 
        DataKeyNames="ABI" OnRowDataBound="OnRowDataBound" >
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <img alt = "" style="cursor: pointer" src="pics/plus.png" />
                    <asp:Panel ID="pnlOrders" runat="server" Style="display: none">

                        <asp:TextBox ID="gvOrders" runat="server" CssClass = "ChildGrid" Text="aa">

                        </asp:TextBox>
                    </asp:Panel>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:ButtonField ItemStyle-Width="150px" DataTextField="N017" HeaderText="Contact Name"/>
            <asp:BoundField ItemStyle-Width="150px" DataField="N028" HeaderText="City" />
        </Columns>
    </asp:GridView>
    </form>
</body>
</html>

当我展开并单击ButtonField时,将自动重新加载页面,并且在文本框中我有重复的值。 怎么了?

0 个答案:

没有答案