System.Web.UI.WebControls.XmlDataSoureNodeDescriptor does not contain a property with the name

2 posts, 0 answers
  1. Johann
    Johann avatar
    2 posts
    Member since:
    Mar 2013

    Posted 11 Mar 2013 Link to this post

    Hi

    I have a simple RadAutoCompleteBox as follows :-

    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
        <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server"
            DataTextField="Name" DataValueField="Id" DataSourceID="XmlDataSource1"
            />
     
    <asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="Persons.xml">
    </asp:XmlDataSource>
     
    </div>
    </form>
    and the XML File looks like this

    <?xml version="1.0" encoding="utf-8"?>
    <Persons>
      <Person>
        <Id>1</Id>
        <Name>Rita</Name>
        <Surname>Nelson</Surname>
        <Age>59</Age>
      </Person>
      <Person>
        <Id>2</Id>
        <Name>Simon</Name>
        <Surname>West</Surname>
        <Age>59</Age>
      </Person>
      <Person>
        <Id>3</Id>
        <Name>Richard</Name>
        <Surname>Mitchell</Surname>
        <Age>59</Age>
      </Person>
      <Person>
        <Id>4</Id>
        <Name>Alison</Name>
        <Surname>McGrath</Surname>
        <Age>59</Age>
      </Person>
    </Persons>

    However I am getting this error in a popup on keystroke

    System.Web.UI.WebControls.XmlDataSoureNodeDescriptor does not contain a property with the name "Name"

    What am I doing wrong?

    Thanks for your help
  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 12 Mar 2013 Link to this post

    Hi Johann,

    Your xml file has to have the following structure in order for the binding to work:
    <?xml version="1.0" encoding="utf-8" ?>
    <Persons>
      <Person Name="Rita" Id="1"></Person>
      <Person Name="Simon" Id="2"></Person>
      <Person Name="Richard" Id="3"></Person>
    </Persons>

     

    Kind regards,
    Bozhidar
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top