I know i read a post about using a BindingList for Custom Class for UltraTree and so far it works.
Here's my code
public class ScreenViewList : BindingList<ScreenClass> { } public class ScreenClass { private BindingList<ScreenObjectClass> _screenobjects = new BindingList<ScreenObjectClass>(); public int ScreenID { get; set; } public string ScreenName { get; set; } public Image PrivilegeLevel { get; set; } public BindingList<ScreenObjectClass> _Screenobjects { get { return _screenobjects; } set { _screenobjects = value; } } } public class ScreenObjectClass { private string _name; private int _scrID; private int _objID; public ScreenObjectClass(int ScrID, int ScrObjID, string Name) { _name = Name; _objID = ScrObjID; _scrID = ScrID; } public int ScreenObjectID { get { return _objID; } set { _objID = value; } } public int ScreenID { get { return _scrID; } set { _scrID = value; } } public string ObjectName { get { return _name; } set { _name = value; } } }
the property with Bold in ScreenClass, I want to Display as Image on TreeView but unable to display Image.
On the Form I do this by getting the data from the database.
ScreenViewList _screenviews = new ScreenViewList(); foreach (DataRow rowscreen in ds.Tables[0].Rows) { ScreenClass _screen = new ScreenClass(); _screen.ScreenName = rowscreen["ScreenName"].ToString(); _screen.ScreenID = Convert.ToInt32(rowscreen["ScreenID"]) ; _screen.PrivilegeLevel = Imagelist1.Images[0]; _screenviews.Add(_screen); this.LoadScreenObjects(Convert.ToInt32(rowscreen["ScreenID"]),_screen); } tv.BeginUpdate(); BindingSource bg = new BindingSource(); bg.DataSource = _screenviews; tv.DataSource = bg; tv.EndUpdate(); I see the PrivilegeLevel Column with values as System.Drawing. Can someone please correct me what i am doing wrong here.
Thanks
You can't cast an UltraDataSource into a DataSet. They are two totally different classes and they are not related in any way.
It sounds like you should be casting the grid's DataSource into an UltraDataSource and then dealing with it that way.
Earlier I was using directly binding dataset to Datagrid and at in some other function used to get that dataset from grid. e.g.
dataSetSubTabData = (
DataSet) ugGridData.DataSource;
But after changing grid datasource to UltraDataSource, above line of code is not working and gives wrong casting exception.
Is there any way to get the dataset from grid now? I need that dataset because some operation needs to be done on that.
Using a single space is the easiest way.
If the caption defaults to null or empty and the resultant behavior is to display the key, I saw the expected behavior. My question is then, what's the proper way to hide the caption text?
Setting Text to space effectively made the caption invisible, but it smells like a workaround.
bobgru said:The only non-intuitive thing about the above advice is that the header caption cannot be the empty string or null, both of which are apparently silently rejected. When I set the column Text to a single space, I got a header with just the image.
I'm pretty sure the caption actually default to null or empty. But in that case, the header will display the Key of the column.