RadTreelist -- hide checkboxes

5 posts, 0 answers
  1. Sindu
    Sindu avatar
    46 posts
    Member since:
    Oct 2011

    Posted 17 Nov 2011 Link to this post


    Hi,

    I have a RadTreelist with treelist select column.I have 6 rows in a RadTreelist.My requirement is to hide checkboxes in 2 rows based on a condition.How can hide checkbox in a row? and in which event is used for this purpose?I have given My code below.

     

    <telerik:RadTreeList ID="RadTreeList1" runat="server" OnNeedDataSource="RadTreeList1_NeedDataSource"

     

    AutoGenerateColumns="false" AllowMultiItemSelection="true"

     

    AllowPaging="false" AllowSorting="true" DataKeyNames="ID"

     

    ParentDataKeyNames="PID" AlternatingItemStyle-BackColor ="#EFF5FB" ItemStyle-BackColor="#E0ECF8" ShowTreeLines="true" OnItemDataBound="RadTreeList1_ItemDataBound" Width="100%">

     

    <SelectedItemStyle CssClass="SelectedRow" />

     

    <Columns>

     

     

    <telerik:TreeListBoundColumn DataField="ID" UniqueName="ID" HeaderText="Bound Column" />

     

    <telerik:TreeListSelectColumn HeaderStyle-Width="40px" >

     

    </telerik:TreeListSelectColumn>
    </telerik:RadTreeList >

    Thanks,
    Sindu.

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

    Posted 17 Nov 2011 Link to this post

    Hello Sindu,

    Try the following code snippet.
    C#:
    protected void RadTreeList1_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e)
    {
      if (e.Item is TreeListDataItem)
      {
       TreeListDataItem item = e.Item as TreeListDataItem;
       if (itm["EmployeeID"].Text == "99")
       {
          itm["ClientselectcolUniqueName"].Visible = false;
       }
      }
    }

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sindu
    Sindu avatar
    46 posts
    Member since:
    Oct 2011

    Posted 18 Nov 2011 Link to this post

    Thanks shinu ...

    it is working ...
  5. S
    S avatar
    3 posts
    Member since:
    May 2009

    Posted 19 Apr in reply to Sindu Link to this post

    I know its been long time of this post, I was wondering if anyone know this

     

    how about like visible true false and enabled true false, how do I get it checked

    itm["ClientselectcolUniqueName"].Checked= false;

     

    I know it does not have checked property like a checkbox not selected property

     

    based on my database value I will keep checked or unchecked

    could you please advise

     

  6. S
    S avatar
    3 posts
    Member since:
    May 2009

    Posted 19 Apr in reply to S Link to this post

    I got it working like this using below instaed of select column

    <telerik:TreeListCheckBoxColumn DataField="chkRead" UniqueName="chkRead1" Visible="false" HeaderText="Read Y/N">
    <HeaderStyle></HeaderStyle>
    <ItemStyle HorizontalAlign="Center"></ItemStyle>
    </telerik:TreeListCheckBoxColumn>
    <telerik:TreeListTemplateColumn UniqueName="chkRead" HeaderText="Read Y/N">
    <ItemTemplate>
    <asp:CheckBox ID="chkRead" runat="server" AutoPostBack="true" OnCheckedChanged="chkRead_CheckedChanged" />
    </ItemTemplate>
    </telerik:TreeListTemplateColumn>

    and binding it in the itemdatabound.

    thank you.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017