c# - RadComboBox Binding Selected Value -
i have radcombobox , i'm trying bind selected value data i'm pulling table in database.
<telerik:radcombobox id="cborole" runat="server" datavaluefield="usertype.id" datatextfield="usertype.value" text='<%# bind("usertype") %>' datasourceid="odscertifications" > </telerik:radcombobox>
here data
public partial class certification { public certification() { this.courses = new hashset<certificationcourse>(); } public int id { get; set; } public string title { get; set; } public string description { get; set; } public int duration { get; set; } public nullable<system.datetime> expiration { get; set; } public bool isactive { get; set; } public string createdby { get; set; } public system.datetime createdon { get; set; } public string updatedby { get; set; } public nullable<system.datetime> updatedon { get; set; } public nullable<int> usertypeid { get; set; } public virtual icollection<certificationcourse> courses { get; set; } public virtual systemcode usertype { get; set; } }
the usertype
has attributes value , id upon i'm trying bind datatextfields
, datavaluefields
. however, i'm getting javascript exceptions when trying bind way. javascript message if omitted can't see exact error message is.
here chrome js debugger telling me happening:
uncaught sys.webforms.pagerequestmanagerservererrorexception: sys.webforms.pagerequestmanagerservererrorexception: object of type system.data.entity.dynamicproxies.certification_d985d293565cb0bfd87fa8f8f44d70acf4130d6e138a82d6e486544c53d7fe10 ...<omitted>...y. <asp:objectdatasource runat="server" id="odscertifications" selectmethod="getactivecertifications" typename="sitefinitywebapp.controllers.certificationcontroller"></asp:objectdatasource> public list<certification> getactivecertifications() { using (var db = new entities()) { try { return db.certifications.include("usertype").where(x => x.isactive == true).orderby(x => x.title).tolist(); } catch (exception ex) { exceptionmanager.logexception(this, ex); return null; } } }
i don't have knowledge in rad version of telerik, think problem comes fact trying bind systemcode object combobox, , can handles simple types int / string.
guess should binding usertypeid instead, i'm not sure work because it's nullable.
Comments
Post a Comment