Like the title, I used jquery autocomplete to set some text to some of my labels. Then, click save, but the event save in code behind only recieve "" from the labels.Text even though they already have text. Here is my code.
<input id="search" type="text" placeholder="search" />
...
<asp:Label ID="LabelNYCNhanVienName" runat="server"></asp:Label>
...
<script type="text/javascript">
$(document).ready(function () {
$("#search").autocomplete({
showHeader: true,
select: function (event, ui) {
this.value = (ui.item ? ui.item.FullName : ' ');
$('#<%= LabelNYCNhanVienName.ClientID %>').text(ui.item ? ui.item.bab: ' ');
return false;
},
minLength: 2,
source: function (request, response) {
$.ajax({
...
});
}
});
});
code Behind:
void ButtonSave_Click(object sender, EventArgs e)
{
Titi item = new Titi ();
item.titiName = LabelNYCNhanVienName.Text;
//My problem is here: the LabelNYCNhanVienName.Text always
//return "" even when i use firebug at that time to catch the LabelNYCNhanVienName
//It still have text in it.
OnSave_Event(item);
}
Here is the picture when i debug. At the save event, the Label still has Text:
Hope you can help me get text from the labels. Thank you