Link to home
Start Free TrialLog in
Avatar of reinoutkool
reinoutkoolFlag for Netherlands

asked on

multiple images in treeview

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
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

ASP.NET or WinForms TreeView?
Avatar of reinoutkool

ASKER

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>"
OK, that looks like ASP.NET TreeView.  Did that way work for you?
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?
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

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
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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!