Category Archives: TreeView

[RESOLVED] Frameset

Hi All,

Some says that frameset is obsolete in asp.net and just to use Master Page instead.

However, after play it sometimes, i found that Master Page still can't replace frameset capabilities, even though with AJAX.

In my case, Menu (with a lot of data) is usually will get longer to refresh and can cause slowdown the speed for data entry screeen.

How do we overcome ? or we better use frameset instead.

Opinion are needed.

Thanks,

Andy

andysujoto

i found that Master Page still can't replace frameset capabilities, even though with AJAX.

I disagree.

andysujoto

In my case, Menu (with a lot of data) is usually will get longer to refresh and can cause slowdown the speed for data entry screeen.

In that case it will happen, I suggest that you set your control's viewstate to false. And bind your menu on postback again.

What is viewstate?

Please check out detail here

Hi,

FYI

There are lots of opnions and definetly depends on requirement and if you believe that frameset is going to solve it,fine carry on with frames.

Well ,Once you implement frame just make sure that you don't expect your site/web App to be search engine friendly.Its difficult to print the content of all frames when compared to a normal web page.You cannot bookmark individual pages using browser's Favourites Menu.Otherside just see the benefits of using frames1. One of the most beneficial feature of frames is it lets the user to have multiple pages in the same browser. Using frames we can keep one part of the page static while changing the other parts of the page. If we create a top frame we can use it as a header i.e, as that page is static it acts like an include page. Frames can be used to reduce server load, as there is no need to reload all the pages when ever a new page is visited.

True,You can get most of the benefits from Masterpage Too.

Is you Menu having Static Items or dynamic?

Regards

shabir


Hi Nilsan,

in my case, i use TreeView to display the main menu, and will display sub menu whenever user click on the menu. however, it leads to :

1. even though i put the treeview in ajax update panel, and put the screen entry in another ajax update panel, it will slowdown the performance. even though i had set them to conditional udpate.

2. when i need to call another aspx, it will cause full postback and all menus should be reloaded again. it will takes sometimes, and i had lost all previous menu that had been opened/clicked by the users.


andysujoto

1. even though i put the treeview in ajax update panel, and put the screen entry in another ajax update panel, it will slowdown the performance. even though i had set them to conditional udpate.

Treeview is not compatible with updatepanel if certain conditions are true. Please check it out here

Search for "Controls that are not compatible with updatepanel controls" in that page.

andysujoto

2. when i need to call another aspx, it will cause full postback and all menus should be reloaded again. it will takes sometimes, and i had lost all previous menu that had been opened/clicked by the users.

Could you please elaborate this point? I think that's by design, as you'll redirect to any page, whole page element tree will be recreated and you'll loose all your menu items.



hi shabirhakim,

thanks for your explanation. my menu is dynamic, depend on the user and it's authority. and since this is a business application, i don't think search engine is needed here, am i right ? please share your opinion.

Regards,

Andy


nilsan

Treeview is not compatible with updatepanel if certain conditions are true. Please check it out here

then what is your suggestion ? i had tried menu control. also it's incompatible.

nilsan

Could you please elaborate this point? I think that's by design, as you'll redirect to any page, whole page element tree will be recreated and you'll loose all your menu items.

i had created a master page, on the left side, is the menu, and the right side is the data entry screen. All my aspx are refer to this master page. so when i call another screen, this menu is going to be refreshed. that why i am thinking about frameset, which is only update my right side pane.

you have option like discussed here

Cache dynamic menu - ASP.NET Forums

Regards


hi sharbikim. thanks for the info. it can be one of the solution. can you share the weakpoint ?

please tell me if i am wrong, the difference is we get it from cache rather than read it from database, so it will run a bit faster. but on each page, we still need to recreate the menu one by one. the example given didn't remove the menu creation process right ?

Hi,

No,When it is Cached,Why it will get created again and again.It will get recreated on bases of Expiration you set for cache..

Regards

shabir

perhaps you mistaken me..... of course the cache itself will not be recreated again as long as not expired yet.

what i mean is we still need to go through the treenode.add process right ? as in example below (i get it from byte.com)

protected void LoadTreeView()
{
TreeNodeCollection tnc;

if (Cache["tnc"] == null) // treenodes not in cache
{
// this is where you load the data from SQL before it's cached.
// in this sample, I'm building the treenode collection
// dynamically.
TreeNodeCollection tncNew = new TreeNodeCollection();

for (int i = 0; i < 5; i++)
{
TreeNode tn = new TreeNode("Node" + i.ToString());
for (int j = 0; j < 3; j++)
{
TreeNode tnChild = new TreeNode("ChildNode" +
j.ToString());
tn.ChildNodes.Add(tnChild);
}
tncNew.Add(tn);
}
// Add it to the cache
Cache.Add("tnc", tncNew, null, DateTime.Now.AddMinutes(2),
TimeSpan.Zero, CacheItemPriority.High, null);
tnc = tncNew;
}
else // treenodes have been cached
{
// Get the collection from the cache
tnc = (TreeNodeCollection) Cache["tnc"];
}
foreach (TreeNode tn in tnc)
{
// TreeView1 is the control id
TreeView1.Nodes.Add(tn);
}
}

[RESOLVED] How can i add external Link to my Sitemap

Hi all

how can i create a sitemapnote with an external url like following example?

 <siteMapNode url="http://www.myblog.de/"  title="smart" roles="*"/>
 
 If i use this, it runs in a 404 error.

I hope anyone can help me.

If i am wrong in this Forum please put me in the right one.

That should work....I dont know exact reason why it didnt work....

may be you can try this....

http://forums.aspdotnetstorefront.com/showthread.php?22032-Issue-with-asp-Menu-and-external-links

Thanks.

Thank you for answering.

But there is no errormesaage. This url is shown me. As you see, it runs in a 404 error.
http://localhost:50920/myWebsite/(S(jtiobf55e3rjrmjidf30vd45))/blogdomain.de

This is my treemodedatabound scritpcode

Protected Sub TreeView1_TreeNodeDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs) Handles TreeView1.TreeNodeDataBound
        Dim appPath As String = Me.Request.ApplicationPath
        Dim linkPath As String = e.Node.NavigateUrl.Remove(0, appPath.Length)
        e.Node.NavigateUrl = Me.ResolveUrl("~/" & linkPath)
    End Sub



But where can i place this scriptcode? Have i create an own custum sitemapprovider?

SiteMapNode node = CreateSiteMapNode(page, i);
AddNode(node, GetParentNode(page));
if ((page.UseUrl) && (page.Url.StartsWith("http")))
{
    node.Url = page.Url;
}

It is curious, why the control does not know an external Link. So far i have used a querystring to transport the exernal Link. It is easier for me than if i create a custom sitemapprovider. But it got me interested in why i cannot use an external link.

Hi,

Since we do not know the ApplcationPath and the node navigateUrl in your code. I just guess. Is the Url(http://localhost:50920/myWebsite/(S(jtiobf55e3rjrmjidf30vd45))/blogdomain.de) correct? I notice that you want to point to an external link, however this link is a local link. How about use:

e.Node.NavigateUrl = "http://www.myblog.de"

And If the relativeUrl parameter contains a relative URL(~/someurl), that URL is changed to a relative URL that is correct for the current request path.

So the url will convert to a local path that contain "/localhost:port/".

Seems that your web site use cookieless feature. You need to pay attention to it.

Hope this can help you.

[RESOLVED] Mapping a treeview to a database

Hi,

There is a way to map a tree view to a database structure?

Thanks..

Thanks for your replay, but I want that the values which are contained by the tree node to be put into a database

<div>with respect to the parent-child relationship. In your example it's shown the inverse mapping.</div>

Where are the values coming from that are in your tree view? 

The value may come from an xml file..

So what you really want to do is go from an xml file to a database table? 

Yes, i want that my values to go from the xml file to database, but i map this xml file on a tree for easy editing. So I have a treeview and also the xml file where the values of tree node are stored. My question is how these values either stored like a tree view or into a xml file can go into a database with respect to parent-child relationship?

Hi,

July

My question is how these values either stored like a tree view or into a xml file can go into a database with respect to parent-child relationship

Here's a link that create a sample that demonstrate how to display a treeview with the values stores in database.(also it inculde the database design).

You can check this, I think you will get some idea from it:

http://aspalliance.com/732

Hope this can help you.

[RESOLVED] How to wrap DataTextField of a treeview control

Hi all..

 

I have a tree view control.The text of the tree view childs is very big ,i need to wrap the text of the tree view control.How to do that.Plz help

 

 

 

 

Thanks in advance

Try setting NodeWrap to true and provide a width to the TreeView control

<asp:TreeView ID="treeView1" runat="server" NodeWrap="true" Width="100px">
</asp:TreeView>

Thank u for reply...!

 

I Got the answer which i want

[RESOLVED] Treeview using LINQ to SQL

Hi all,i want to implement  treeview using linq to sql in my db i have hierarchial structure so whenever i click the tree view node it has to display the following nodes below it,any ideas how to achieve this.

Waiting for any replies or ideas for how to implement this?? 

Hi chandu123,

You can bind the output of a Linq query to a treeview  HierarchicalDataTemplate.

Private db As New DataClasses1DataContext(My

.Settings.DP_SQLExpress_SBConnectionString)

 

 

 

 

 

Private Sub Window1_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me

.Loaded

 

Dim results = From bn In db.BoxNames, b In

db.Boxes _

Where

 

b.Box_Number = bn.Box_Number _

Select

 

b Distinct Order By

b.Box_Number

 

TV1.ItemsSource = results

 

End

Sub


<

 

TreeView Name

="TV1">

 

 

 

 

<TreeView.ItemTemplate

>

 

 

 

 

<HierarchicalDataTemplate ItemsSource="{Binding Path

=BoxNames}">

 

 

 

 

<TextBlock Text="{Binding Path

=Box_Number}" />

 

 

 

 

<HierarchicalDataTemplate.ItemTemplate

>

 

 

 

 

<DataTemplate

>

 

 

 

<TextBlock Text="{Binding Path

=Box_Name}"/>

 

 

 

</DataTemplate

>

 

 

 

</HierarchicalDataTemplate.ItemTemplate

>

 

 

 

 

</HierarchicalDataTemplate

>

</

 

TreeView.ItemTemplate

>

 

 

 

</TreeView>

Please check the followingl link:

http://stackoverflow.com/questions/589243/treeview-linq-to-sql-recursive-data-population

http://social.msdn.microsoft.com/Forums/en-IE/wpf/thread/f6ed9ff7-ed55-4c92-8943-87051ffe215f

Thanks for your reply but i want the code in c#.