Hi there
When I create nodes with a web service, I also want to add attibutes to the node, so that I can read it some other stage.
It does not seem to work."The given key was not present in the dictionary" Error.
Please advise
[WebMethod] |
public RadTreeNodeData[] GetManufacturers(RadTreeNodeData node, object context) |
{ |
IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context; |
String sql = ""; |
String parentname = ""; |
if (node.Value == "HardwareType") |
{ |
sql = "SELECT 'Manufacturer' as [value], manufacturer as [text], hardwareType as [parentName] from tHardwareCatalog WHERE hardwareType = '" + node.Text + "' GROUP BY hardwareType, manufacturer ORDER BY manufacturer"; |
} |
else if (node.Value == "Manufacturer") |
{ |
parentname = node.Attributes["parentName"].ToString(); |
sql = "SELECT id as [value], model as [text], manufacturer as [parentName] from tHardwareCatalog WHERE hardwareType = '" + parentname +"' AND manufacturer = '" + node.Text + "' ORDER BY model"; |
} |
SqlDataAdapter adapter = new SqlDataAdapter(sql, ConfigurationManager.ConnectionStrings["RemoteSqlServerData"].ConnectionString); |
DataTable data = new DataTable(); |
adapter.Fill(data); |
List<RadTreeNodeData> result = new List<RadTreeNodeData>(); |
foreach (DataRow row in data.Rows) |
{ |
RadTreeNodeData itemData = new RadTreeNodeData(); |
itemData.Text = row["text"].ToString(); |
itemData.Value = row["value"].ToString(); |
itemData.Attributes.Add("parantName",row["parentName"].ToString()); |
if (row["value"].ToString() == "Manufacturer") |
{ |
itemData.ExpandMode = TreeNodeExpandMode.WebService; |
} |
result.Add(itemData); |
} |
return result.ToArray(); |
} |
When I create nodes with a web service, I also want to add attibutes to the node, so that I can read it some other stage.
It does not seem to work."The given key was not present in the dictionary" Error.
Please advise