Results 1 to 2 of 2

Thread: GridView count colmun items

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2015
    Posts
    102

    GridView count colmun items

    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>
    Last edited by kankon; Dec 15th, 2019 at 11:52 AM.

  2. #2
    Banned
    Join Date
    Dec 2019
    Posts
    9

    Re: GridView count colmun items

    Could you please make your question a bit more clear? Do you mean that you're trying to migrate the sql server from asp.net into c#?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width