I have a dropdown list which is binded to a dataTable as follows:
MatID MatName MatGroupID
1 Mat1 11
2 Mat2 22
3 Mat3 33
<asp:DropDownList ID="DropDownList_MAT" runat="server" AutoPostBack="true" OnSelectedIndexChanged="UpdateDetails" DataTextField="MatGroupID" DataValueField="Matname" />
<asp:Label ID="Label_StaticMatName" runat="server" />
code:
protected void UpdateDetails(object sender, EventArgs e)
{
Label_StaticLockGroupName.Text = DropDownList_MAT.SelectedItem.Value;
}
MatGroupID i have assigned as DataTextField and DataValueField is MatName. When i select a value in dropdown i want the textfield the value field as well as MatID. How do i maintain the MatID as the user selects dropdown value every time