Solved

multiple images in treeview

Posted on 2009-07-07
8
438 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
  • 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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