0
我想要在我的GridView標題和該標題行的複選框字段中的按鈕。GridView中的按鈕標題和複選框字段asp.net
我希望下面的代碼可以工作。但是,這不起作用。我只看到頭文件中的「刪除」文本,當我點擊它時什麼也沒有發生。
我做錯了什麼?
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" CellPadding="4" ForeColor="#333333"
GridLines="None" OnRowCommand="Gridview2_RowCommand">
<Columns>
<asp:BoundField DataField="fname" HeaderText="First Name" />
<asp:BoundField DataField="mname" HeaderText="Middle Name" />
<asp:BoundField DataField="lname" HeaderText="Last Name" />
<asp:TemplateField HeaderText="Remove">
<ItemTemplate>
<asp:CheckBox ID="checkselect" runat="server" />
</ItemTemplate>
<asp:HeaderTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Split">sort</asp:LinkButton>
</asp:HeaderTemplate>
</asp:TemplateField>
</Columns> </Gridview>
的即使行命令
protected void Gridview2_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Split")
{
Response.Write("I was clicked");
}
}
有人可以幫助我?
它工作正常....你可能沒有看到文本只有bcz的gridview隱藏.... –
Gridview隱藏? – Huzaifa
我沒有把它藏在任何地方。 – Huzaifa