Find Control Issue

9 posts, 0 answers
  1. Prassin
    Prassin avatar
    87 posts
    Member since:
    Jun 2012

    Posted 27 Jun 2012 Link to this post

    Hi all,

     i have an issue with my tree list.. i need to find controls  "OnEditCommand" event in my rad tree list ... 

    please help ..


    Regards,

    Prassin
  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 28 Jun 2012 Link to this post

    Hi Prassin,

    If you have a custom edit form template with controls of your own, just use e.Item.FindControl("IDofYourControl"). If you are using the built-in edit forms, then you can use the Extract values method to get any of the field values in the edit form:

    Hashtable newValues = new Hashtable();
    ((TreeListEditableItem)e.Item).ExtractValues(newValues);

    Hope it helps.

    Greetings,
    Tsvetoslav
    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. Prassin
    Prassin avatar
    87 posts
    Member since:
    Jun 2012

    Posted 28 Jun 2012 Link to this post

    Hi Tsvetoslav,

    I have tried this code.. i can get the value from a particular control.. but my wish is not that..  i need to find a control and wish to assign the control "ReadOnly" state or "Disabled " in my tree list .. that is my requirement... please help..


    Regards,

    Prassin
  5. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 28 Jun 2012 Link to this post

    Hello Prassin,

    Could you paste your code (aspx and code-behind) using the CODE FORMATTER tool of the ticket editor.

    Regards,
    Tsvetoslav
    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. Prassin
    Prassin avatar
    87 posts
    Member since:
    Jun 2012

    Posted 28 Jun 2012 Link to this post


    <asp:TextBox ID=
    "txtBoxcode" Text='<%# Bind("SubCatCode") %>' runat="server" Height="8Pt"
        Style="text-transform: uppercase" MaxLength="4">
     </asp:TextBox>

    Protected Sub RadTreeList1_EditCommand(ByVal sender As Object, ByVal e As TreeListCommandEventArgs)
           Dim item As TreeListDataItem = TryCast(e.Item, TreeListDataItem)
           Dim txt As TextBox = TryCast(item.FindControl("txtBoxcode"), TextBox)
           txt.Enabled = False
       End Sub


  7. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 28 Jun 2012 Link to this post

    Hi Prassin,

    Just do it in the ItemDataBound event as follows:

    Protected Sub RadTreeList1_ItemDataBound(sender As Object, e As TreeListItemDataBoundEventArgs)
        If TypeOf e.Item Is TreeListEditFormItem AndAlso DirectCast(e.Item, TreeListEditFormItem).IsInEditMode Then
            Dim item As TreeListEditableItem = TryCast(e.Item, TreeListEditableItem)
      
            Dim textBox = TryCast(item.FindControl("txtDiscount"), TextBox)
      
            textBox.Enabled = False
        End If
    End Sub

    Hope it helps.

    Greetings,
    Tsvetoslav
    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. Prassin
    Prassin avatar
    87 posts
    Member since:
    Jun 2012

    Posted 28 Jun 2012 Link to this post

    Hi..

    Thanks soo much.. its working fine.. and one more thing ... i wish to enable that textbox while click add parent item... edit time need to disable too...


  9. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 28 Jun 2012 Link to this post

    Hi Prassin,

    Then, the following code snippet should prove helpful:

    Protected Sub RadTreeList1_ItemDataBound(sender As Object, e As TreeListItemDataBoundEventArgs)
        If TypeOf e.Item Is TreeListEditFormInsertItem Then
            Dim item As TreeListEditFormInsertItem = TryCast(e.Item, TreeListEditFormInsertItem)
      
            Dim textBox = TryCast(item.FindControl("txtDiscount"), TextBox)
      
            textBox.Enabled = True
        ElseIf TypeOf e.Item Is TreeListEditFormItem AndAlso DirectCast(e.Item, TreeListEditFormItem).IsInEditMode Then
            Dim item As TreeListEditableItem = TryCast(e.Item, TreeListEditableItem)
      
            Dim textBox = TryCast(item.FindControl("txtDiscount"), TextBox)
      
            textBox.Enabled = False
        End If
    End Sub



    Kind regards,
    Tsvetoslav
    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.
  10. Prassin
    Prassin avatar
    87 posts
    Member since:
    Jun 2012

    Posted 28 Jun 2012 Link to this post

    Hi Tsvetoslav,

    Thanks soo much for your help...


    Regards,

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