Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1010
  • Last Modified:

Multicolumn Treeview for Webpart for wss 3.0??

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
guessdip
Asked:
guessdip
1 Solution
 
MsShadowCommented:
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
 
JJBrooks13Commented:
Take a look at the GridViewTree here: www.DigitalTools.com/GVT.aspx

GVT.jpg
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
guessdipAuthor Commented:
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
 
declanmcdCommented:
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
 
guessdipAuthor Commented:
Hiii, How can i format single column ?? Can you give me any command?? i used String.RightPad but it does not work.
0
 
declanmcdCommented:
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
 
guessdipAuthor Commented:
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
 
guessdipAuthor Commented:
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
 
declanmcdCommented:
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
 
guessdipAuthor Commented:
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
 
declanmcdCommented:
So it's like I suggested?
0
 
guessdipAuthor Commented:
Thank you Dude..
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now