Solved

multiple images in treeview

Posted on 2009-07-07
8
434 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now