<label class="col-sm-2 control-label"> EmployeeStatus: <span class="symbol required"></span> </label> <div class="col-sm-3"> <asp:DropDownList CssClass="form-control" ID="ddlEmpStatus" runat="server" OnSelectedIndexChanged="ddlEmpStatus_SelectedIndexChanged" AutoPostBack="true" /> <asp:RegularExpressionValidator runat="server" ID="revddlEmpStatus" ControlToValidate="ddlEmpStatus" Required="required" Display="Dynamic"></asp:RegularExpressionValidator> </div>
protected void ddlEmpStatus_SelectedIndexChanged(object sender, EventArgs e) { if (ddlEmpStatus.SelectedValue == "Absent") { ddlDutyType.Visible = false; ddlEmployeeShift.Visible = false; txtEndDate.Visible = false; txtHasWirles.Visible = false; } else { txtStartDate.Visible = true; txtEndDate.Visible = true; ddlDutyType.Visible = true; ddlEmployeeShift.Visible = true; } }