Category Archives: TreeView

TreeView

[RESOLVED]treeview and imageset and Arrows ? how can arrows display phosporic bright green colour ?

hi

when i set imageset of treeview to arrows, i can see black triangle if nodes have childnodes.. i can see epmty black trianlge if nodes have no childnodes…. how can i display it as phosporic bright green triangle colour if nodes have childnodes and how
can i display it as phosporic bright green empty triangle if nodes have no childnodes ?

Can you give me example ?

Thanks

 

Hi,

You can create custom image files for non-expandable node and expandable node, and then place them in a directory in your Web site, and then set the following properties on your TreeView control to reference the images:

  • <div mce_keep="true">CollapseImageUrl </div>
  • <div mce_keep="true">ExpandImageUrl </div>
  • <div mce_keep="true">NoExpandImageUrl </div>

For more information, see Customizing the Look and Feel of the TreeView Web Server Control ( http://msdn.microsoft.com/en-us/library/ms178262.aspx).

I look forward to receiving your test results.  

hi

thank you for your reply

which software should i use to create image files like phosporic green ? also it should be like 3D

is there free software for this ? for example there is free green box for creating banner.

Thanks

Hi,

Thanks for your response.

You can search the free tool on internet or ask your boss who is your Image Design in your company.

 

Thanks.

hi

sorry for my last question :)

Thanks

[RESOLVED]Javascript for a tree node value

function selection(){
	var nodeText = '';
        var nodeValue = '';
	function temp(li){
		if( li.getAttribute('selected') != 'true' ) return;
		var a = li.getElementsByTagName('A')[0];
		if( !a ) return;
		nodeText = (a.innerHTML);
                nodeValue = li.getAtribute('nodeValue');
	}
	<%=this.astvTree.GetClientTreeObjectId() %>.traverseTreeNode( temp);

	document.getElementById('<%=txtName.ClientID %>').value = nodeText;
        document.getElementById('<%=txtInvisible.ClientID %>').value = nodeValue;
}

Hi, i have an astreeview, and i want to store selected node value in a textbox. I have the above function, the node text work properly (nodeText = (a.innerHTML)), but node value doesn’t (nodeValue = li.getAtribute(‘nodeValue’)).
I
do not
realize what’s wrong … getAtribute(‘nodeValue’) maybe?

Change li.getAtribute(‘nodeValue’) to li.getAttribute(‘nodeValue’)
and give it another try.

Thanks :))

nodeValue = li.getAttribute(‘treeNodeValue’); – is correct

[RESOLVED]Visual studio 2005 design view

Hai..

am working in visual studio 2005. All was going smooth, but the problem occurs 2 hours back. Now I can’t find the html controls in the desig view, but all are there in the code view. I didn’t  know what happened. It is same for all the pages now. But I can
see the controls when i debug the project and when i upload the pages. I can’t see the controls in design view. I think it should be some minor problem, but I can’t trace it out…… Please help

try to rebuild your application, sometimes it makes difference

 Hai, Rami Nassar…. tanx 4 ur reply, but that solution is not working.. any other idea…….

 Hai……….. I restored my system to an earlier time, so now i can able to see the controls in design view. But an .aspx.cs file is missing (deleted or moved). I already saved the code before system restore, so its not become an issue. But still I want
to know what happened before (I can’t find the html controls in the design view, but all are there in the code view). If anybody have any idea, please let me know. I am afraid – if the problem occurs again…….

Please reply

It could be for many reasons.

mmm, maybe one of your html tags are not closed!  from the source view, do right click and click on synchronize document outline, this will give a treeview for your html tags.

or if you are using masterpage, and you are placing the content placeholder inside a Table server control, then the content page will not be editable, so you will not be able to see the controls in the design view.

check if the inheritance attribute in the page directive is equal the class name in the .cs file.

 or you can post your html code to figure out what is going on .

 

One minor thing to be noted is, if you have opened a

 

 Hai…all

The problem was solved. I don’t know whether that was the exact solution, i have some solutions here.

This is how i got it right…….I restored my system to an earlier time, so now i can able to see the controls in design view. But an .aspx.cs file is missing (deleted or moved). I already saved the code before system restore, so its not become an issue.

some of my friends told me that it may be bcse of the html tags are not closed.. but i checked that and that was not my issue.

 Another problem may be that "if the inheritance attribute in the page directive is not equal to the class name in the .cs file", the error may occur, and I suspect that was my problem because i renamed the .aspx & .aspx.cs page to another name, but the
inheritance attribute in the .aspx page directive might not change to the name in the .cs file..

 eg:this is correct (<%@ Page AutoEventWireup="true" CodeFile="mypage.aspx.cs" Inherits="mypage" Language="C#" %>)

but my code was <%@ Page AutoEventWireup="true" CodeFile="mypage.aspx.cs" Inherits="page" Language="C#" %>

I suspect this was the problem, but i didn’t get the oppertunity 2 find out as i already solved the issue by system restore

Tree View any node click event Javascript

Hi ,

I need to call a client side validation once they click on tree view : please let me know how can i achive this using java script.

I tried few methods : it was not working. 

I have a master page -> Nested master page -> Tree view. so

alert(document.getElementById("<%=trv.ClientID %>").value); was not working.

I tried few other way . didnt work , any help will be appreciated.

Thanks

Giri

I tried the below code , it was showing object is null error.

    <script type = "text/javascript">
       
function OnLoad() {
           
var links = document.getElementById("<%=TreeView1.ClientID %>").getElementsByTagName("a");
           
for (var i = 0; i < links.length; i++) {
                links
[i].setAttribute("href", "javascript:NodeClick("" + links[i].id + "", "" + links[i].getAttribute("href") + "")");
           
}
       
}
        window
.onload = OnLoad;
       
function NodeClick(id, attribute) {
           
//Do Something
            alert
(id + " clicked");
           
eval(attribute);
       
}
   
</script>

Hi,

Set a breakpoint, and debug with IE developer Tools.

[RESOLVED]Tree View Javscript

Hi ,

Am using the below code to handle message box in my page : but its appearing on any click of the tree view.

I just would like to show message only navigate url is there .

<script runat="server">

 

 

 

    protected void Page_Load(object sender, EventArgs e)

    {

        string confirmMessage = "Yes/No?";

        string script = @"function treeNodeConfirmation(mEvent, text)

                    {

                        var o;

                        // Internet Explorer

                        if (mEvent.srcElement)

                        {

                            o = mEvent.srcElement;

                        }

                        // Netscape and Firefox

                        else if (mEvent.target)

                        {

                            o = mEvent.target;

                        }

 

 

                        if(o.tagName == ‘A’ || o.tagName == ‘a’)

                        {

                            return confirm (text);

                        }

 

 

                    }";

 

 

        ScriptManager.RegisterClientScriptBlock(trv, typeof(TreeView), "treeNodeClickConfirm", script, true);

       

       trv.Attributes.Add("onclick", "javascript:return treeNodeConfirmation(event, ‘" + confirmMessage + "’)");

    }

</script>

But i would like to handle only during my tree view node clicked which having navigate URL.

Now message is appearing for the simple

Hi, you can try the following method:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('a').click(function () {
                var herf = $(this).attr("href");
                if (herf.indexOf("javascript:__doPostBack") == "-1") {
                    var result = confirm("Yes/No?");
                    return result;
                }
            })
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TreeView ID="TreeView1" runat="server">
            <Nodes>
                <asp:TreeNode NavigateUrl="test.aspx" Text="a"></asp:TreeNode>
                <asp:TreeNode Text="b"></asp:TreeNode>
            </Nodes>
        </asp:TreeView>
    </div>
    </form>
</body>
</html>

[RESOLVED]AJAX & VS2012

I am trying the new version of VS by editing the WebSite template. I was trying to add an ajax modal popup.
So, I added the ajax tool kit to get the extenders. 
When I added a modal popup extender it said that I had to use the toolkit script manager. So, I added it to the page -- now, I can't have two scriptmanagers on the same page.
I tried replacing the asp:scriptmanager with the toolkit version. The scriptmanager, however has a bunch of links to jquery scripts.(What are they for?)
 <asp:ScriptManager runat="server">
        <Scripts>
            <%--Framework scripts--%>
            <asp:ScriptReference Name="MsAjaxBundle" />
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="jquery.ui.combined" />
            <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
            <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
            <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
            <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
            <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
            <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
            <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
            <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
            <asp:ScriptReference Name="WebFormsBundle" />
            <%--Site scripts--%>

        </Scripts>
    </asp:ScriptManager>
So if I run it with that scriptmanager i get :

Server Error in ‘/’ Application.


Could not load file or assembly ‘System.Web’ or one of its dependencies. The system cannot find the file specified.

How do you get AJAX exetenders on this Master (Site.Master)??

 

You might want to check this blog post of Stephen Walter, you’ll find an answer to your question ( what js references are specified in ScriptManager control ), also how to use ajax control toolkit with asp.net 4.5 ( step by step )

http://stephenwalther.com/archive/2012/09/20/september-2012-release-of-the-ajax-control-toolkit.aspx