GridView count colmun items
I know this from sql server....
how to do it from asp.net language c#
sql code
Code:
SELECT COUNT(OPsec)
FROM Table_infoname
WHERE OPsec='ENG'
I want count 2 thing ENG and Users by Selected from checkbox
ENG = label1
Users = label2
GridView column OPsec
Code:
<asp:GridView ID="GridView1" runat="server" HeaderStyle-CssClass = "header" AutoGenerateColumns = "False" Font-Names = "Arial" Font-Size = "12pt" AlternatingRowStyle-BackColor = "#C2D69B" Height="100%" Width="100%" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" >
<AlternatingRowStyle BackColor="#DCDCDC"></AlternatingRowStyle>
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="checkAll" runat="server" onclick = "checkAll(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" onclick = "Check_Click(this)" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Id" HeaderText="م" InsertVisible="False" ReadOnly="True" SortExpression="Id" />
<asp:BoundField DataField="name" HeaderText="إسم الموظف" SortExpression="name" >
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="jop" HeaderText="المسمى الوظيفي" SortExpression="jop" >
<ItemStyle Font-Size="Small" />
</asp:BoundField>
<asp:BoundField DataField="civilid" HeaderText="الرقم المدني" SortExpression="civilid" >
<ItemStyle Font-Size="Small" />
</asp:BoundField>
<asp:BoundField DataField="markazel3mal" HeaderText="القسم" SortExpression="markazel3mal" >
<ItemStyle Font-Size="Small" />
</asp:BoundField>
<asp:BoundField DataField="eldarajah" HeaderText="الدرجة" SortExpression="eldarajah" >
<ItemStyle Font-Size="Small" />
</asp:BoundField>
<asp:BoundField DataField="OPusers" HeaderText="القسم" SortExpression="OPusers" >
<ItemStyle Font-Size="Small" /> </asp:BoundField>
<asp:BoundField DataField="DateTimePicker1" HeaderText="بداية الاجازة" SortExpression="DateTimePicker1" DataFormatString="{0:yyyy/MM/dd}" >
<ItemStyle Font-Size="Small" /> </asp:BoundField>
<asp:BoundField DataField="DateTimePicker2" HeaderText="نهاية الاجازة" SortExpression="DateTimePicker2" DataFormatString="{0:yyyy/MM/dd}" >
<ItemStyle Font-Size="Small" /> </asp:BoundField>
<asp:BoundField DataField="workin" HeaderText="نوع الاجازة" SortExpression="workin" >
<ItemStyle Font-Size="Small" />
</asp:BoundField>
<asp:BoundField DataField="OPeng" HeaderText="مدة الاجازة" SortExpression="OPeng" >
<ItemStyle Font-Size="Small" />
</asp:BoundField>
<asp:BoundField DataField="OPsec" HeaderText="مهندس" SortExpression="OPsec" >
<ItemStyle Font-Size="Small" />
</asp:BoundField>
</Columns>
<EditRowStyle BorderStyle="Solid" />
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<HeaderStyle BackColor="#42ABDD" Font-Bold="True" ForeColor="Black" Font-Size="18pt" />
<PagerSettings Position="Top" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" Font-Bold="True" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#0000A9" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#000065" />
</asp:GridView>