[CLOSED] Problem with formpanel.setvalues

  1. #1

    [CLOSED] Problem with formpanel.setvalues

    Error 3 An anonymous type cannot have multiple properties with the same name C:\Work\AcciseOffLine\AcciseOffLine\Flotte\Page.as px.cs 34 17 AcciseOffLine


     ObjFleet flotta = BusinessFleet.GetById(int.Parse(ID));
    this.FormPanel1.SetValues(new
    {
    flotta.Name,
    flotta.Description,
    flotta.Owner.Description
    });
    <ext:TextFieldID=&quot;TextFieldNome&quot;runat=&quot;server&quot;FieldLabel=&quot;Nome&quot;DataIndex=&quot;Name&quot;Disabled=&quot;true&quot;/>
    <ext:TextFieldID=&quot;TextFieldDescription&quot;runat=&quot;server&quot;FieldLabel=&quot;Descrizione&quot;DataIndex=&quot;Description&quot;Height=&quot;50&quot;/>
    <ext:TextFieldID=&quot;TextFieldOwner&quot;runat=&quot;server&quot;FieldLabel=&quot;Owner&quot;DataIndex=&quot;Owner.Description&quot;/> //// is correct???
    Last edited by Daniil; Oct 11, 2010 at 5:39 PM. Reason: [CLOSED]
  2. #2
    https://examples1.ext.net/#/Form/Com...ield/Overview/

     FormPanel1.SetValues(new
    {
    Name = flotta.Name,
    Description = flotta.Description,
    Owner = flotta.Owner.Description 
    });
    is correct?
  3. #3
    Hi,

    I'm not sure what you're trying to do but the code that is in your second post looks fine.

    A DataIndex should be matched with a property name of object which is passed as a parameter to the SetValues method.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            TestClass testClass = new TestClass { 
                Name = "Name", 
                Description = "Description",
                Owner = "Owner"
            };
            this.FormPanel1.SetValues(new
            {
                Name = testClass.Name,
                Description = testClass.Description,
                Owner = testClass.Owner
            });
        }
    
        class TestClass
        {
            public string Name { get; set; }
            public string Description { get; set; }
            public string Owner { get; set; }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:FormPanel ID="FormPanel1" runat="server">
            <Items>
                <ext:TextField runat="server" DataIndex="Name" />
                <ext:TextField runat="server" DataIndex="Description" />
                <ext:TextField runat="server" DataIndex="Owner" />
            </Items>
        </ext:FormPanel>
        </form>
    </body>
    </html>

Similar Threads

  1. Replies: 2
    Last Post: Mar 30, 2012, 5:52 AM
  2. Replies: 0
    Last Post: Sep 02, 2011, 10:10 PM
  3. combobox in formpanel problem
    By adayioglu in forum 1.x Help
    Replies: 1
    Last Post: Apr 22, 2011, 9:42 PM
  4. combobox in formpanel problem
    By adayioglu in forum 1.x Help
    Replies: 1
    Last Post: Apr 19, 2011, 9:46 AM
  5. Replies: 0
    Last Post: May 20, 2010, 7:57 AM

Posting Permissions