Edit checkboxes directly and text in a popup EditForm Template

7 posts, 1 answers
  1. Paul
    Paul avatar
    29 posts
    Member since:
    Aug 2011

    Posted 03 Nov 2011 Link to this post

    I have a TreeList with text columns and checkbox columns. Is there a way to allow the checkboxes to be clicked and change state in the TreeList and display a popup dialog for text editing?

  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 08 Nov 2011 Link to this post

    Hello Paul,

    Please examine the Accessing Cells and Items help topic to see how to access the checkboxes.
    The RadTreeList provides pop-up editing mode. You can see it here.

    I hope this helps.

    Greetings,
    Mira
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Paul
    Paul avatar
    29 posts
    Member since:
    Aug 2011

    Posted 09 Nov 2011 Link to this post

    I was a bit vague with my question. By allow the checkboxes to be clicked and change state in the TreeList, I meant strictly client side, no AJAX, clicking a checkbox would fire an client-side script where I could change the state of the checkbox and possibly change the enabling/disabling of other checkboxes within the same record.

    I found a similar post to mine, but I have not been able to get it to work. I define the TreeList server-side:

     

    Dim checkBoxColumn As New TreeListCheckBoxColumn()
    tlConfig.Columns.Add(checkBoxColumn)
    checkBoxColumn.DataField = “Auditability“
    checkBoxColumn.UniqueName = “Auditability”
    checkBoxColumn.HeaderText = “Auditability”
    checkBoxColumn.HeaderStyle.Width = Unit.Pixel(50)
    checkBoxColumn.ReadOnly = False
    checkBoxColumn.ItemStyle.CssClass = "centered"

    In the ItemDataBound event:
    If TypeOf e.Item Is TreeListDataItem Then
        Dim treeListDataItem As TreeListDataItem = CType(e.Item, TreeListDataItem)
        DirectCast(e.Item.FindControl("Auditability"), CheckBox).Attributes("onclick") = _
                [String].Format("return Auditable_onClick('{0}', event);", _
                DirectCast(treeListDataItem.DataItem, ConfigListItem).Index.ToString())
    End If


    The problem I am having is the “e.Item.FindControl("Auditability")”. When I use VS QuickWatch to examine the available controls, I cannot find Auditability, but I can find clientIDs. Is there a way around this or does not work when the TreeList is define server-side?

  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 09 Nov 2011 Link to this post

    Hello Paul,

    Please use the following code in order to find the checkboxes and set the onclick event handlers:
    If TypeOf e.Item Is TreeListDataItem Then
        Dim treeListDataItem As TreeListDataItem = CType(e.Item, TreeListDataItem)
        DirectCast(treeListDataItem("Auditability").Controls(0), CheckBox).Attributes("onclick") = String.Format("return Auditable_onClick('{0}', event);", _
                DirectCast(treeListDataItem.DataItem, ConfigListItem).Index.ToString())
    End If

    I hope this helps.

    Greetings,
    Mira
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. Paul
    Paul avatar
    29 posts
    Member since:
    Aug 2011

    Posted 09 Nov 2011 Link to this post

    Thanks for the response Mira.

    I tried your code. The function
    Auditable_onClick is not being called. Just for the heck of it I tried to reference Controls(1) and get an index out of range, so there is only one control. I also tried changing the [Attributes(“onclick”)] to [Attributes.Add(“onclick”,] with the same result.
  7. Answer
    Mira
    Admin
    Mira avatar
    1124 posts

    Posted 11 Nov 2011 Link to this post

    Hello Paul,

    I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.

    I hope it helps.

    All the best,
    Mira
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  8. Paul
    Paul avatar
    29 posts
    Member since:
    Aug 2011

    Posted 11 Nov 2011 Link to this post

    Thanks that really helped.

    Paul

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