I know how to get the selected value of an item in a normal RadCombobox, but now that I have added autocomplete functionality to the RadCombobox. This doesn't return the selected value..

Convert.ToInt32(rcboVendor.SelectedValue);

all that is doing is returning empty

This is the RadCombobox in the markup

<telerik:RadComboBox ID="rcboVendor" runat="server" Width="100%" EmptyMessage="Type in Vendor" AllowCustomText="true" MarkFirstMatch="true" Filter="Contains" OnSelectedIndexChanged="rcboVendor_SelectedIndexChanged" AutoPostBack="true"></telerik:RadComboBox>

this is how I am trying to get the data in my code behind on a click event

po.VendorID = Convert.ToInt32(rcboVendor.SelectedValue);

and this is how I am populating the radcombobox

public List<Vendor> lstVendors()
    {
        var getVendors = from v in GenOps.Vendors
                         select v;
        return getVendors.Where(w => w.ClientID == 2).ToList<Vendor>();
    }

When I set a break point on this method it shows that it is returning the VendorID, and this is how I am populating the RadCombobox on the Page_Load event

rcboVendor.DataSource = GODall.lstVendors();
rcboVendor.DataValueField = "VendorID";
rcboVendor.DataTextField = "VendorName";
rcboVendor.DataBind();

I've searched around for a solution but the only thing I am finding is...

Convert.ToInt32(RadCombobox.SelectedValue)

But it doesn't help. So I am not sure what the issue is.

Any idea on how to get the SelectedValue?

Related posts

Recent Viewed