Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is my code of asp
ASP.NET
<label class="col-sm-2 control-label">
                   Select Sector:
               </label>
               <div class="col-sm-3">
                  <asp:DropDownList CssClass="form-control" runat="server" MaxLength="7" ID="ddlToSector" OnSelectedIndexChanged="ddlToSector_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                    </div>
           <label class="col-sm-2 control-label">
               Strenght:
           </label>
           <div class="col-sm-1">
               <asp:TextBox runat="server" ID="txtStrenght" AutoPostBack="true" ></asp:TextBox>
           </div>
       </div>

code behind

C#
var employeeCounts = _service.GetAllEmployeeDuty().Where(x => x.ToSector_Id == '2');
            txtStrenght.Text = employeeCounts.ToString();

I want that when a sector is selected then it total strenght is display in this field,as against each employee there is a sector id is store in the duty table.
in short from employeeduty table column name ToSector_Id collect all the employee for this sector Id and return total no in int
Posted

1 solution

Create a stored procedure take the sector as parameter and in SP identify the number of employee against that sector.

Return the value to C# and you got the number of employees.

you may refer to
http://stackoverflow.com/questions/6341819/get-sql-data-and-show-it-in-a-text-box[^]
and
how to display data from sql database to textbox using C#.net[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900