$(document).ready(function () {
$("#MainContent_ddlFieldName").live("change", function () {
var id = $(this).val();
var name = $(this + "option:selected").text();
$('#<%= lblValue.ClientID %>').text(name);
$('#<%= lblType.ClientID %>').text(id);
});
});
<asp:Label ID="lblValue" runat="server" Text="" Visible="true"></asp:Label>
<asp:Label ID="lblType" runat="server" Text="" Visible="true"></asp:Label>
protected void btnSearch_Click(object sender, EventArgs e)
{
string strValue = lblValue.Text;
string strType = lblType.Text;
}
Im using javascript and Asp.Net to get the value of a dropdownlist and put it in a label. It actually show the text to the label and when i click a button or event i'm getting its previous value w/c is ""
Can anyone help me with this.
Thx