Take This Items In webForms
- One gridView
- One button checkAll/UncheckAll
- One Button for Delete all the Checked CheckBox..
Lets see one by one how can we put checkbox inside GridView
Use This Source File In Html
- One gridView
- One button checkAll/UncheckAll
- One Button for Delete all the Checked CheckBox..
Lets see one by one how can we put checkbox inside GridView
Use This Source File In Html
[asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"]
[Columns]
[asp:BoundField DataField="roll_no" HeaderText="Roll No" /]
[asp:BoundField DataField="s_name" HeaderText="Student Name" /]
[asp:BoundField DataField="class" HeaderText="Class" /]
[asp:TemplateField]
[ItemTemplate]
[asp:CheckBox ID="ch1" Text='<%# Eval("roll_no") %>' runat="server" /]
[/ItemTemplate]
[/asp:TemplateField]
[/Columns]
[/asp:GridView]
In your .cs file in the class level write this line of code
First Use This Code in Page load
ArrayList alist = new ArrayList();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//Populate data and Bind in Gridview
}
}
Use This Code In Check All Button Click Event