PDA

View Full Version : [CLOSED] Error in example "Ajax linked combos"



Jurke
Oct 05, 2008, 10:19 AM
Hi
I tried this example:

https://examples1.ext.net/#/Form/ComboBox/Ajax_Linked_Combos/

and get compiler error on this line

data.Add(new{Id=id, Name = name});

In the function "CitiesRefresh"

Is this suppose to work? or is ther a coding error?

Best Regards
Mikael Jürke

Vladimir
Oct 05, 2008, 10:28 AM
It is syntax of .NET 3.0 (http://msdn.microsoft.com/en-us/library/bb397696.aspx)

Please ensure that your project under .NET 3.0 (or change code to appropriate .NET 2.0)

Jurke
Oct 06, 2008, 10:43 AM
Hi
Okay I see, I tried to find the 2.0 syntax for the code, without succes. Do you know how to write it in 2.0?

Best regards
Mikael Jürke

Vladimir
Oct 06, 2008, 10:50 AM
Just create a class City for example with properties Id and Name



public class City
{
private string id;
private string name;

public City()
{
}

public City(string id, string name)
{
this.id = id;
this.name = name;
}

public string Id
{
get { return id; }
set { id = value; }
}

public string Name
{
get { return name; }
set { name = value; }
}
}


//use in web service
data.Add(new City(Id, Name));

Jurke
Oct 06, 2008, 11:22 AM
Im running 3.5 framework, so I think the code should work.
Thats strage.