Using CheckBox to select rows in ASP.NET GridView

With a control GridViewin .NET, is there a way to change a parameter Selectin GridViewto Checkbox, how do you select multiple lines?

I tried adding CheckBoxFieldto mine GridView, but when I started it, it did not appear.

+3
source share
4 answers

Adding a checkbox in Gridview is as simple as adding a TemplateField to any control.

I tried adding a CheckBoxField to my gridview, but when I run it, it does not show.

There must be other columns linking the data to the grid. Also, check the visible box property.

. .

+2

ASP.NET, ,

+1

, , ExpertSoul headup . , , :

<asp:TemplateField>
    <ItemTemplate>
        <asp:CheckBox ID="PublicationSelector" runat="server" />
    </ItemTemplate>
</asp:TemplateField>

, , onclick, # , ...

.

+1

DataTable, .

dt.Columns.Add(new DataColumn("Include", typeof(Boolean)));

SQL :

declare @include bit
set @include = 0
select 
@include Include,
....

0

Source: https://habr.com/ru/post/1712603/


All Articles