Solved

multiple images in treeview

Posted on 2009-07-07
8
439 Views
Last Modified: 2012-05-07
is it possible to add multiple images in a treeview-row with different actions?

as far as I know it is only possible to add only one custom image and even that image.

the idea would be
+ [image] [image] [image] itemname
+ [image] [image] [image] itemname
etc

hope someone can help!
or is there an other tool for the job
0
Comment
Question by:reinoutkool
[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
  • 4
  • 4
8 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24805608
ASP.NET or WinForms TreeView?
0
 

Author Comment

by:reinoutkool
ID: 24806041
vb.net treeview

the only way I can think of is:
node.txt = "text of node here"
node.txt = node.txt + "<a href='#'><img scr='path-to-img'></a>"
node.txt = node.txt + "<a href='#'><img scr='path-to-img'></a>"
node.txt = node.txt + "<a href='#'><img scr='path-to-img'></a>"
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24807158
OK, that looks like ASP.NET TreeView.  Did that way work for you?
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:reinoutkool
ID: 24808523
yes it works. but now the links are normal html links, not postback. isn't there a way to add multiple link buttons to the treeview?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24808630
When you create a LinkButton, it renders as a special anchor element, with a call to __doPostBack.

      <a id="LinkButton1" href="javascript:__doPostBack('LinkButton1','')">LinkButton</a>&nbsp;</div>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
 
 
<div>
 
	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLGrYuuCwLM9PumD+FE4KFENnlaEGuQ4O6N7u//H6Ff" />
</div>
    <div>
      <a id="LinkButton1" href="javascript:__doPostBack('LinkButton1','')">LinkButton</a>&nbsp;</div>
  </form>
</body>
</html>

Open in new window

0
 

Author Comment

by:reinoutkool
ID: 24820776
yes, but is it possible to mix strings with an imagebutton?

Dim lnk As New ImageButton()
lnk.ImageUrl = "path here"
lnk.PostBackUrl = "url here"
node.txt = "some string"
node.txt = node.txt + lnk
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 24840857
I would suggest when you have a simple question like "is it possible" to set up a small test web site and web page to test that theory.  That is all I do when I test out your question.

Here is what I would suggest from a small test with a HyperLink:

    <asp:HyperLink ID="HyperLink1" runat="server" Text="Test" ImageUrl="~/im01.jpg" NavigateUrl="~/Default2.aspx" />

That was rendered like this:

   <a id="HyperLink1" href="Default2.aspx"><img src="im01.jpg" alt="Test" style="border-width:0px;" /></a>
 
You would need to replicate that HTML style in your code, if possible.
0
 

Author Comment

by:reinoutkool
ID: 24847170
yes I'm aware of make a test page, and that's what I do often. the questions was if treeeview was the right tool foor the job and if so, is the solution I suggested the right thing to do. or if there is another, better, solution.
I tried to mix html and hard coded postback links as you suggested and that works fine.
problem solved!
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display

739 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