We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

TreeView control

Hi Guru, I have requirment something very very similar to Explorer. We’d like an entry to be added to the treeview and for the user to type in the some name into the treeview section (something similar to what happens in the explorer program when a new folder is created). If the somename is valid, then it needs to be store into database. Validation for somename would be same as creation a new file in the explorer. I would like to check, whether this name exists in the tree already if it exists throw an error message to change the somename to other. Do you have any sample something very similar? Thanks Satish

7 Replies

AD Administrator Syncfusion Team June 11, 2004 08:12 PM UTC

Hi Satish, Please take a look at the sample in the directory ...\Syncfusion\Essential Suite\2.0.5.1\Tools\Samples\Tree Package\TreeViewAdvOwnerDraw. The TreeViewAdv has to be targetted to a particular directory in the disk and then manually populated as shown in the code below : private void treeViewAdv2_BeforeExpand(object sender, Syncfusion.Windows.Forms.Tools.TreeViewAdvCancelableNodeEventArgs e) { if(e.Node.ExpandedOnce) return; string path = e.Node.GetPath("\\"); ArrayList dirs = new ArrayList(Directory.GetDirectories(path)); for(int i=0;i0) TreeNodeAdv node = new TreeNodeAdv(dir.Substring(lastIndex)); e.Node.Nodes.Add(node); } } Please refer to it and let me know if this meets your requirements. Regards, Guru Patwal Syncfusion,Inc.


SA Satish June 14, 2004 09:18 AM UTC

Hi Guru, Please find the application and the document. Thanks Satish >Hi Satish, > >Please take a look at the sample in the directory ...\Syncfusion\Essential Suite\2.0.5.1\Tools\Samples\Tree Package\TreeViewAdvOwnerDraw. The TreeViewAdv has to be targetted to a particular directory in the disk and then manually populated as shown in the code below : > >private void treeViewAdv2_BeforeExpand(object sender, Syncfusion.Windows.Forms.Tools.TreeViewAdvCancelableNodeEventArgs e) > { > if(e.Node.ExpandedOnce) return; > > string path = e.Node.GetPath("\\"); > ArrayList dirs = new ArrayList(Directory.GetDirectories(path)); > for(int i=0;i { > string dir = (string)dirs[i]; > int lastIndex = dir.LastIndexOf("\\")+1; > // if(lastIndex <=0) lastIndex = dir.LastIndexOf(":")+1; > // if(lastIndex>0) > TreeNodeAdv node = new TreeNodeAdv(dir.Substring(lastIndex)); > e.Node.Nodes.Add(node); > } > } > >Please refer to it and let me know if this meets your requirements. > >Regards, >Guru Patwal >Syncfusion,Inc. TreeViewWithContextMenu_4970.zip


AD Administrator Syncfusion Team June 15, 2004 12:11 PM UTC

Hi Satish, You can achieve what you require using Syncfusion popupmenus instead of context menus. TreeViewCancelPopUpForums_1914.zip Please take a look at the sample and let me know if you have any questions. Thanks. Best regards, Stephen. >Hi Guru, >Please find the application and the document. >Thanks >Satish > > > >>Hi Satish, >> >>Please take a look at the sample in the directory ...\Syncfusion\Essential Suite\2.0.5.1\Tools\Samples\Tree Package\TreeViewAdvOwnerDraw. The TreeViewAdv has to be targetted to a particular directory in the disk and then manually populated as shown in the code below : >> >>private void treeViewAdv2_BeforeExpand(object sender, Syncfusion.Windows.Forms.Tools.TreeViewAdvCancelableNodeEventArgs e) >> { >> if(e.Node.ExpandedOnce) return; >> >> string path = e.Node.GetPath("\\"); >> ArrayList dirs = new ArrayList(Directory.GetDirectories(path)); >> for(int i=0;i> { >> string dir = (string)dirs[i]; >> int lastIndex = dir.LastIndexOf("\\")+1; >> // if(lastIndex <=0) lastIndex = dir.LastIndexOf(":")+1; >> // if(lastIndex>0) >> TreeNodeAdv node = new TreeNodeAdv(dir.Substring(lastIndex)); >> e.Node.Nodes.Add(node); >> } >> } >> >>Please refer to it and let me know if this meets your requirements. >> >>Regards, >>Guru Patwal >>Syncfusion,Inc. > >TreeViewWithContextMenu_4970.zip > >


SA Satish June 16, 2004 01:10 AM UTC

Hi Stephen, Thanks for your sample. Example was quick impressive but I cannot use the syncfusion popup''s as i am already using Context Menu''s. Is there any way with Context Menu to implment the same thing. Thanks Satish >Hi Satish, > >You can achieve what you require using Syncfusion popupmenus instead of context menus. > >TreeViewCancelPopUpForums_1914.zip > >Please take a look at the sample and let me know if you have any questions. Thanks. > >Best regards, > >Stephen. > >>Hi Guru, >>Please find the application and the document. >>Thanks >>Satish >> >> >> >>>Hi Satish, >>> >>>Please take a look at the sample in the directory ...\Syncfusion\Essential Suite\2.0.5.1\Tools\Samples\Tree Package\TreeViewAdvOwnerDraw. The TreeViewAdv has to be targetted to a particular directory in the disk and then manually populated as shown in the code below : >>> >>>private void treeViewAdv2_BeforeExpand(object sender, Syncfusion.Windows.Forms.Tools.TreeViewAdvCancelableNodeEventArgs e) >>> { >>> if(e.Node.ExpandedOnce) return; >>> >>> string path = e.Node.GetPath("\\"); >>> ArrayList dirs = new ArrayList(Directory.GetDirectories(path)); >>> for(int i=0;i>> { >>> string dir = (string)dirs[i]; >>> int lastIndex = dir.LastIndexOf("\\")+1; >>> // if(lastIndex <=0) lastIndex = dir.LastIndexOf(":")+1; >>> // if(lastIndex>0) >>> TreeNodeAdv node = new TreeNodeAdv(dir.Substring(lastIndex)); >>> e.Node.Nodes.Add(node); >>> } >>> } >>> >>>Please refer to it and let me know if this meets your requirements. >>> >>>Regards, >>>Guru Patwal >>>Syncfusion,Inc. >> >>TreeViewWithContextMenu_4970.zip >> >> > > > >


AD Administrator Syncfusion Team June 17, 2004 08:42 AM UTC

Hi Satish As per my other forum posting, refer to the TreeViewAdvDemo sample (Tools\samples\Tree Package\TreeViewAdvDemo). This sample shows how you can use a context menu along with the TreeViewAdv control. Regards Arun


SA Satish June 17, 2004 09:11 AM UTC

>Hi Satish > >As per my other forum posting, refer to the TreeViewAdvDemo sample (Tools\samples\Tree Package\TreeViewAdvDemo). This sample shows how you can use a context menu along with the TreeViewAdv control. > >Regards >Arun


SA Satish June 17, 2004 09:12 AM UTC

Hi Arun, Thanks for your mail. I have already implemented this. thanks Satish > > >>Hi Satish >> >>As per my other forum posting, refer to the TreeViewAdvDemo sample (Tools\samples\Tree Package\TreeViewAdvDemo). This sample shows how you can use a context menu along with the TreeViewAdv control. >> >>Regards >>Arun

Loader.
Live Chat Icon For mobile
Up arrow icon