Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

multiple images in treeview

Posted on 2009-07-07
8
Medium Priority
?
443 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
How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

 

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 750 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

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…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

719 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