?
Solved

Multicolumn Treeview for Webpart for wss 3.0??

Posted on 2010-01-10
13
Medium Priority
?
992 Views
Last Modified: 2012-05-08
Hii All,

  i have one site collection and for reporting i need to make some custom webpart in c# and i use vs 2008 and i develop Webpart for sharepoint. I need to display hierarchical data so i have decided Treeview control , i use three layer  but i have to display five column in one treenode so i used string = column1 + column2 +column3 + column4.. But it look not good, user can not idetify column easily, i need to dispaly in tabular format.  

So can you please give me some suggetion about it..
0
Comment
Question by:guessdip
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
13 Comments
 
LVL 19

Expert Comment

by:MsShadow
ID: 26282401
I would consider using Infragistics controls to do that, they have a nice design and are fast:

http://www.infragistics.com/dotnet/netadvantage/aspnet/webtree.aspx#Overview
0
 

Expert Comment

by:JJBrooks13
ID: 26283144
Take a look at the GridViewTree here: www.DigitalTools.com/GVT.aspx

GVT.jpg
0
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

Author Comment

by:guessdip
ID: 26285604
MSShadow : I tried to download but i am not able to download free trial. Can i use this control for Web Part?? in my case ListA is connected with ListB  and ListB with ListC...

vora_bhaumik : i would like to use this treeview for reporting perpose. i have to fetch report from four to five list.so i think i can not use bamboo.
I already did something for it look not good, i am aatching jpg file. In my trre all child node and parent node has more column together.

in treenode can i use table format??

Tree.JPG
0
 
LVL 3

Expert Comment

by:declanmcd
ID: 26321282
You could approach it adiferent way and just use a fixed width font such as Courier and format each field to be a fixed length. That way all columns as you have them already, would line up perfectly.

That's certainly the easiest and quickest way of achieving what you want.
0
 

Author Comment

by:guessdip
ID: 26328115
Hiii, How can i format single column ?? Can you give me any command?? i used String.RightPad but it does not work.
0
 
LVL 3

Accepted Solution

by:
declanmcd earned 2000 total points
ID: 26339263
For example see below.
I set up your sample DataTable and added a few sample rows.
I then defined your column lengths (_lengths ).

Then I just iterated through your dataset and formatted the columns into a standard output format.

The Label1 just shows the finished formatted output in a pseudo-tabular format. Achieved by seetting the font to a fixed width font such as Courier New and replacing the spaces with   if your are using a browser.

Does this help?




DataTable dt = new DataTable();
dt.Columns.Add("Column1");
dt.Columns.Add("Column2");
dt.Columns.Add("Column3");
dt.Columns.Add("Column4");
dt.Columns.Add("Column5");
dt.Columns.Add("Column6");

dt.Rows.Add("czadap1", "NotAssigned", "4/28/2009", "Post-EOSL", "Completed", "Decom w/o Remediation");
dt.Rows.Add("ktazd2415", "3/15/2009", "5/1/2009", "Remediation", "started", "Decom w/Remediation");
dt.Rows.Add("ktazd5086", "7/13/2009", "11/30/2009", "Planning", "started", "Decom w/Remediation");

int[] _lengths = new int[]{11, 13, 13 , 13, 11 , 25};


string _output = "";

foreach (DataRow dr in dt.Rows)
{
	int _row = 0;
	foreach (string _item in dr.ItemArray)
	{
		_output += _item.PadRight (_lengths[_row], ' ');
		_row++;
	}
	_output += "<br>";
}

Label1.ControlStyle.Font.Name = "Courier New";
Label1.Text = _output.Replace (" ", "&nbsp;");

Open in new window

0
 

Author Comment

by:guessdip
ID: 26343321
Hii,
 Thanks for helping me.. I tried your same code and i used Treenode.Text = _output.Replace(" ", "&nbsp;"); Becase i can not use Lable1.text in Treenode. it works fine but still we are getting space formating problem. i am attaching output..

I think when column has less character then specify lenght then we can get problem with space.. , i am trying to solve , i will let you know if i solve this problem. and let me know if i made any mistake..

Once again thank you.
output.bmp
0
 

Author Comment

by:guessdip
ID: 26343486
Hi,
 i found that if i display lable then it looks whatever i need, but when i display string then it looks not good. i also tried to change fontname of treeview..
0
 
LVL 3

Expert Comment

by:declanmcd
ID: 26343791
It just looks like your values for the length you are using are not big enough. That is what would normally cause the lines to look like what you have in your image. Try increasing the length of the strings and see if that makes a difference.
Post your code and let us see.
0
 

Author Comment

by:guessdip
ID: 26352484
Hiii,
 I got the solution .. i used <Font face > tag to change fontname in a string and it works fine.So i will close this question , for knowledge i am playing with code, if we mention lenght = 15 and if our column has lenght 20 then i would like to display five character in new line..

Thank You ..
0
 
LVL 3

Expert Comment

by:declanmcd
ID: 26355292
So it's like I suggested?
0
 

Author Closing Comment

by:guessdip
ID: 31675375
Thank you Dude..
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question