Checkbox in telerik TreeView Context menu

4 posts, 0 answers
  1. faisal
    faisal avatar
    34 posts
    Member since:
    May 2011

    Posted 07 Jun 2011 Link to this post

    Hi,

    i am working on telerik tree view context menu. kindly tell me is there any way to add checkbox in context menu of telerik tree view.

    with regards,

    Faisal
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Jun 2011 Link to this post

    Hello faisal,
    You can achieve the requirement by using ItemTempate inside RadContext menu.
    Here is the sample code.
    <telerik:RadTreeView runat="server" ID="RadTreeView1" OnClientContextMenuItemClicked="OnClientContextMenuItemClicked"
    OnContextMenuItemClick="OnContextMenuItemClick">
    <ContextMenus>
             <telerik:RadTreeViewContextMenu ID="menu1">
                <ItemTemplate>
                    <asp:CheckBox ID="chkBx1" runat="server" Text='<%# DataBinder.Eval(Container, "Text") %>' />
               </ItemTemplate>
               <Items>
                   <telerik:RadMenuItem Text="MoveUp" />
                   <telerik:RadMenuItem Text="MoveDown" />
                   <telerik:RadMenuItem Text="Send E-Mail" />
               </Items>
            </telerik:RadTreeViewContextMenu>
    </ContextMenus>
        <Nodes>
         <telerik:RadTreeNode Text="People">
                 <Nodes>
                <telerik:RadTreeNode Text="Johny" Value="1" ContextMenuID="menu1" />
                <telerik:RadTreeNode Text="Jimmie" Value="2" />
                <telerik:RadTreeNode Text="Donie" Value="3" />
                </Nodes>
         </telerik:RadTreeNode>
       </Nodes>
    </telerik:RadTreeView>
    Also take a look at the following help document.
    Data-binding expressions
    Thanks,
    Shinu.
  3. faisal
    faisal avatar
    34 posts
    Member since:
    May 2011

    Posted 07 Jun 2011 Link to this post

    By doing this only checkboxes are showing with no text.
    and number of checkboxes are equal to number of radmenuitems. kindly tell me more

    With regards,

    Faisal
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Jun 2011 Link to this post

    Hello Faisal,

    I suppose you want to show CheckBox as one ContextMenu item. If that is the requirement, try setting the CheckBox as shown below.

    aspx:
    <telerik:RadTreeView runat="server" ID="RadTreeView3">        
      <ContextMenus>
         <telerik:RadTreeViewContextMenu ID="menu1">              
             <Items>
              <telerik:RadMenuItem Text="Add" />
              <telerik:RadMenuItem Text="Edit" />
              <telerik:RadMenuItem>
                 <ItemTemplate>
                      <asp:CheckBox ID="chkBx1" runat="server" Text="some text" />
                </ItemTemplate>
              </telerik:RadMenuItem>
       </Items>
        </telerik:RadTreeViewContextMenu>
      </ContextMenus>
    </
    telerik:RadTreeView>


    Thanks,
    Princy.
Back to Top