Search code examples
asp.nettreeview

trouble with treeview asp.net web form


when i want to show data in tree view in asp.net page it got trouble after load. you cat find picture of my trouble as below. trouble with treeview asp.net web form

by the way here is tree view cod:

<asp:TreeView ID="TreeView_Permiss" runat="server" 
    ImageSet="Simple" 
    NodeIndent="10"
    ontreenodepopulate="TreeView1_TreeNodePopulate" 
    Font-Size="Medium" 
    style="font-size: large" 
    CssClass="wideboxed" >
    <HoverNodeStyle Font-Underline="false" ForeColor="#DD5555" />
    <LeafNodeStyle ImageUrl="~/img/trvi/ball_redS.gif" />
    <NodeStyle Font-Names="Tahoma" Font-Size="Large" ForeColor="Black"
        HorizontalPadding="0px" NodeSpacing="0px" VerticalPadding="0px"
        Font-Bold="False" ImageUrl="~/img/trvi/RizKilid.png" />
    <ParentNodeStyle Font-Bold="True" ImageUrl="~/img/trvi/RizKilid.png"
        Font-Italic="False" />
    <SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px" 
        VerticalPadding="0px" ForeColor="#DD5555" />
</asp:TreeView>

if it is possible please hep me to solve this problem. thanks for your attention.

private void UDF_GetAllPermOfUser(String Str_UserName)
    {
        TreeView_Permiss.Nodes.Clear();
        TreeNode trn = new TreeNode("Default.aspx");
        trn.SelectAction = TreeNodeSelectAction.None;
        //trn.NavigateUrl = "Default.aspx";
        trn.PopulateOnDemand = false;
        trn.Text = "Privete Pgaes Permission . . .";
        trn.ImageUrl = "~/img/trvi/base.gif";

        if (trn.Text == "Privete Pgaes Permission . . .")
        {
            trn.ShowCheckBox = false;
        }

        TreeView_Permiss.Nodes.AddAt(0, trn);

        PopulateRootLevel();
        TreeView_Permiss.CollapseAll();
        TreeView_Permiss.ExpandAll();
    }

Solution

  • Your trouble is in this place trn.ImageUrl = "~/img/trvi/base.gif"; you should remove gif files from your asp.net host or you should contact your host administrator to allow gif files to run in IIS of you asp.net HOST.

    Change gif files to jpg or png files, then test; if it still does not work, then contact the host admin.