|
Rank: Newbie Groups: Member
Joined: 2/23/2009 Posts: 5
|
Hello (sorry for my possible bad english, I'm from Spain). I'm using a treeview, and I need all nodes display a checkbox, two buttons and a text (text is data bound), so I'm using "Embedded CustomItem". But as far I know I need to write a customItem specification to each treeview level. I need to define only one custom item specification to all levels. Here is my code, can you help me please?:
Code: HTML/ASPX
<eo:TreeView ID="tvComponentes" AutoScroll="true" Height="415px" runat="server" Width="700px" DataFields="CodigoYDescripcion" >
<TopGroup>
<TemplateItem>
<CustomItem>
<div style="float:left;">
<asp:CheckBox ID="cbSeleccion" runat="server" CssClass="botonSeleccionGV"/>
<cc2:ToggleButtonExtender ID="tbeSeleccion" runat="server" TargetControlID="cbSeleccion" ImageWidth="22" ImageHeight="22" UnCheckedImageUrl="~/Comun/Imagenes/General/bullet_off.png" CheckedImageUrl="~/Comun/Imagenes/General/bullet_on.png" />
</div>
<asp:ImageButton ID="ibEditar" runat="server" CommandArgument='<%#((System.Data.DataRow)Container.DataItem)["Codigo"]%>' CommandName="Editar" ImageUrl="~/Comun/Imagenes/General/editar_bullet.png" />
<asp:ImageButton ID="ibBorrar" runat="server" CommandArgument='<%#((System.Data.DataRow)Container.DataItem)["Codigo"]%>' CommandName="Borrar" ImageUrl="~/Comun/Imagenes/General/borrar_bullet.png" />
<asp:Label runat="server" ID="lblCodigoYDescripcion" Text='<%#((System.Data.DataRow)Container.DataItem)["CodigoYDescripcion"]%>' ></asp:Label>
</CustomItem>
</TemplateItem>
</TopGroup>
</eo:TreeView>
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You can nest TemplateItem. It will be something like this:
Code: HTML/ASPX
<TopGroup>
<TemplateItem>
<CustomItem>
abc
</CustomItem>
<SubGroup>
<TemplateItem>
<CustomItem>
def
</CustomItem>
</TemplateItem>
</SubGroup>
</TemplateItem>
</TopGroup>
Your other option is to use simple HTML as TreeNode text since TreeNode text can take any valid HTML. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 2/23/2009 Posts: 5
|
If I nest TemplateItem, i need to write one TemplateItem for each level, right? But there can be a lot of levels!. I think I can use your second option: HTML as TreeNode text. But I don't know how can I do. I use a DataSet with parent-child relation:
Code: C#
DataSet ds = ObtainItems();
DataRelation dr = new DataRelation("Codigo_PadreCodigo", ds.Tables[0].Columns["Codigo"], ds.Tables[0].Columns["PadreCodigo"]);
dr.Nested = true;
ds.Relations.Add(dr);
tvComponentes.DataSource = ds;
tvComponentes.DataBind();
How can I set TreeNode Text to add my HTML? Can this text reffer to databound item data? Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, The easiest way is to handle ItemDataBound event. Inside that event handler you can access DataItem property and then the newly created TreeNode's Text based on the DataItem. I believe DataItem is a DataRow object when your data source is a DataSet. So you will need to cast it first: http://doc.essentialobjects.com/library/1/eo.web.navigationitem.dataitem.aspxThanks!
|
|
Rank: Newbie Groups: Member
Joined: 2/23/2009 Posts: 5
|
Ok, It works using TreeNode Text with ItemDateBound. It's solved. Thanks!!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Cool. Glad you got it working!
|
|