Please help me
private ObservableCollection<treemodel> tempAddData()
{
ObservableCollection<treemodel> temp = new ObservableCollection<treemodel>();
//new treeModel { IsExpand=false, Name = "megh",Contact="122" ,Address="ktm" ,IsVisible="Visibile", ParentName="" },
//new treeModel { IsExpand=false , Name = "sita", Address="pk",Contact="123456" , IsVisible="Visibile" , ParentName="megh" },
//new treeModel { IsExpand=false, Name = "gita",Address="lon" ,Contact="988484", IsVisible="Collapsed" , ParentName="sita"},
//new treeModel { IsExpand=false, Name = "ranjit",Address="india",Contact="984" , IsVisible="Collapsed" , ParentName="sita"},
//new treeModel { IsExpand=false, Name = "teatime",Address="kkf" ,Contact="2144", IsVisible="Visible" , ParentName="megh"},
//new treeModel { IsExpand=false, Name = "execuew",Address="6644" ,Contact="1233" ,IsVisible="Visibile" , ParentName="teatime"},
//new treeModel { IsExpand=false, Name = "ee", Address="1233" ,Contact="122", IsVisible="Collapsed", ParentName="execuew"} //Working
using (SqlConnection cmain = new SqlConnection(GlobleClass.DataConnectionString))
using (SqlCommand cmd = cmain.CreateCommand())
{
cmain.Open();
cmd.CommandText = @"SELECT * FROM MENUITEM WHERE LEVELS =1 and parent='MI'";//Not working
using (SqlDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
{
temp.Add(new treeModel
{
DESCA = dr["DESCA"].ToString(),
Parent = dr["Parent"].ToString(),
MGROUP = dr["MGROUP"].ToString(),
MCAT = dr["MCAT"].ToString()
});
}
}
}
return temp;
}