用于在ASP中插入的网格

时间:2011-05-30 09:25:11

标签: c# asp.net datagrid asp-classic

我想在ASP中添加一个网格只使用Insert Commend不想在select select和其他命令上工作,我已经插入了其他网格但在那里显示其他数据也有任何网格我可以使用仅用于插入,还想插入多行

<asp:FormView ID="FormView1" runat="server" DataKeyNames="Card_code" 
            DataSourceID="SqlDataSource1">
            <EditItemTemplate>
                Card_code:
                <asp:Label ID="Card_codeLabel1" runat="server" 
                    Text='<%# Eval("Card_code") %>' />
                <br />
                Description:
                <asp:TextBox ID="DescriptionTextBox" runat="server" 
                    Text='<%# Bind("Description") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                Card_code:
                <asp:TextBox ID="Card_codeTextBox" runat="server" 
                    Text='<%# Bind("Card_code") %>' />
                <br />
                Description:
                <asp:TextBox ID="DescriptionTextBox" runat="server" 
                    Text='<%# Bind("Description") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                Card_code:
                <asp:Label ID="Card_codeLabel" runat="server" Text='<%# Eval("Card_code") %>' />
                <br />
                Description:
                <asp:Label ID="DescriptionLabel" runat="server" 
                    Text='<%# Bind("Description") %>' />
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Edit" />
                &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="Delete" />
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                    CommandName="New" Text="New" />
            </ItemTemplate>
        </asp:FormView>

这里是这段代码中的代码我只希望Insert Command不想执行其他操作

0 个答案:

没有答案