I'm working on an asp.net app with bootstrap and jquery. In my "contact us view" I have button dropdown for choice the subject of the mail. When I click on an item of the list a label get the value in this is a jquery process. When I try to retrieve the label's data in my code behind in C# it seems that the value of the label has never been set with any value.
the asp label that I need value:
<asp:Label ID="lblObjetTextOnServer" ClientIDMode="Static" runat="server" type ="text">Objet</asp:Label>
my jquery:
$('.dropdown-menu li a').on('click', function () {
$("#lblObjetTextOnServer").val($(this).text());
$("#lblObjetText").html($(this).text());
});
My drop down menu:
<div class ="dropdown">
<asp:Button ID="Btn_dll_objet" Class="btn btn-default dropdown-toggle" type ="button" data-toggle="dropdown" >Votre demande concerne : <span class ="caret"></span></asp:Button>
<ul ID="dropdown-menu" class ="dropdown-menu" role ="menu" aria-labelledby="dropdownMenu1">
<li class ="dropdown-header">Informations et conventionnement</li>
<li><a tabindex="-1" href="#">Demande d'information</a></li>
<li><a tabindex="-1" href="#">Question sur le conventionnement en ligne</a></li>
<li><a tabindex="-1" href="#">Mise a jour de votre fiche partenaire</a></li>
<li role="separator" class="divider"></li>
<li class ="dropdown-header">Transactions</li>
<li><a tabindex="-1" href="#">Question / incident : transactions par débit en ligne</a></li>
<li><a tabindex="-1" href="#">Question / incident : transactions par ticket</a></li>
<li><a tabindex="-1" href="#">Question sur relevé ou paiement</a></li>
<li role="separator" class="divider"></li>
<li class ="dropdown-header">Autre</li>
<li><a tabindex="-1" href="#">J'ai une question sur un autre sujet</a></li>
</ul>
</div>
My code behind:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string subj =((Label)lblObjetTextOnServer.FindControl("lblObjetTextOnServer")).Text;
}
}