I have a RADComboBox on my ASPX page as shown below:
<telerik:RadComboBox RenderMode="Lightweight" ID="cboxEmployee" runat="server" Width="400" Height="400px" AutoPostBack="false" EmptyMessage="select employee here" CssClass="validationClass" OnSelectedIndexChanged="cboxAccused_SelectedIndexChanged"> </telerik:RadComboBox>I Bind the ComboBox with this C# code:
private void BindAccusedDropdowns() { using (PSDEntities context = new PSDEntities()) { cboxEmployee.DataSource = context.LawsonEmployees.OrderBy(s => s.LAST_NAME).ToList(); cboxEmployee.DataTextField = "DISPLAY"; cboxEmployee.DataValueField = "EID"; cboxEmployee.DataBind(); cboxEmployee.AllowCustomText = true; cboxEmployee.MarkFirstMatch = true; } }The Box functions properly on the page I can select an employee.
When I attempt to get the SelectedValue of the comboBox with this code it returns a null value.
a.EID = Convert.ToInt32(cboxEmployee.SelectedValue);
Any idea why this happening?