On my client side I have an html select where changing the index changes an html label with jquery
$(document).ready(function () {
$("select[name = sreport]").change(function () {
var selected = $("option:selected", this).text();
if (selected == "Seleccione el tipo de Reporte") {
$('#divtxtbuscar').hide();
$('#divbuscar').hide();
$("label[for = sreport]").text("");
}
else if (selected == "Por Operación") {
$('#divtxtbuscar').show();
$('#divbuscar').show();
$("label[for = sreport]").text("Folio de Operación:");
}
else if (selected == "Por No. de Parte") {
$('#divtxtbuscar').show();
$('#divbuscar').show();
$("label[for = sreport]").text("No. de Parte:");
}
else if (selected == "Por Maquina") {
$('#divtxtbuscar').show();
$('#divbuscar').show();
$("label[for = sreport]").text("No. de Maquina:");
}
else if (selected == "Por Empleado") {
$('#divtxtbuscar').show();
$('#divbuscar').show();
$("label[for = sreport]").text("No. de Empleado:");
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<label>Tipo de Reporte:</label>
<select id="cmb" name="sreport" class="form-control" >
<option value="seleccionar">Seleccione el tipo de Reporte</option>
<option value="operacion">Por Operación</option>
<option value="parte">Por No. de Parte</option>
<option value="maquina">Por Maquina</option>
<option value="empleado">Por Empleado</option>
</select>
<div id="divtxtbuscar" class="form-group" style="display: none">
<label id="lblsreport" for="sreport" runat="server"></label><br />
<asp:TextBox ID="txtbuscar" runat="server" CssClass="form-control"></asp:TextBox>
</div>
Now what I want is to take the value of my label from the side of my server (C #) and save it in a variable but I can not use .value, I use innertext and it does not return anything. What other option do I have?
Or how can I change an asp label instead of an html?