gridview中的多个选择按钮

时间:2015-08-21 06:53:12

标签: c# asp.net gridview

我试图在网格视图中创建多个选择按钮

然而,我似乎遇到了一些问题

未使用以下代码选择记录

<asp:GridView ID="GridView1" runat="server" CssClass="table table-bordered text-nowrap" AutoGenerateColumns="False" DataKeyNames="Qutation_ID"  OnRowDeleting="GridView1_RowDeleting" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowCommand="GridView1_RowCommand">
                                    <Columns> 
                                        <asp:BoundField DataField="Qutation_ID" HeaderText="Qutation ID" InsertVisible="False" ReadOnly="True" SortExpression="Qutation_ID" />
                                        <asp:BoundField DataField="CustID" HeaderStyle-CssClass="hiddencol" HeaderText="Customer ID" InsertVisible="False" ItemStyle-CssClass="hiddencol" ReadOnly="True" SortExpression="Qutation_ID">
                                        <HeaderStyle CssClass="hiddencol" />
                                        <ItemStyle CssClass="hiddencol" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />                                        
                                        <asp:BoundField DataField="Subject" HeaderText="Subject" SortExpression="Subject" />
                                        <asp:ButtonField Text="Click" CommandName="ActionCommand" ItemStyle-Width="30"  />
                                    </Columns>
                                    <EmptyDataTemplate>
                                        "No records found"
                                    </EmptyDataTemplate>
                                </asp:GridView>

    protected void ActionCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "ActionCommand")
        {
            msg.Text = GridView1.SelectedRow.Cells[1].Text;

        }

    }

0 个答案:

没有答案