FindControl

8 posts, 0 answers
  1. eran
    eran avatar
    14 posts
    Member since:
    Jul 2010

    Posted 25 Jul 2010 Link to this post

    Hi Telerik,

    i am having problem to findcontrol in the itemTemplate. is there anyway i can call the label in the itemTemplate ? i am using visual studio 2008 with vb.net

    Best Regards,
    ER AN
  2. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 26 Jul 2010 Link to this post

    Hello Eran,

    Please examine the following links:
    Accessing cells and rows
    How to: Access Members of a Control's Naming Container
    Understanding the naming container hierarchy of ASP.NET databound controls

    Kind regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. eran
    eran avatar
    14 posts
    Member since:
    Jul 2010

    Posted 26 Jul 2010 Link to this post

    hi telerik,

    i am using listview. is there anyway to find the control in the itemTemplate ?

    Best regard,
    ER AN
  5. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 26 Jul 2010 Link to this post

    Hello Eran,

    Accessing Controls in RadListView

    Protected Sub RadListView1_ItemCreated(sender As Object, e As RadListViewItemEventArgs)
     If TypeOf e.Item Is RadListViewDataItem Then
      Dim label As Label = TryCast(e.Item.FindControl("Label1"), Label)
     End If
    End Sub

    Regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. eran
    eran avatar
    14 posts
    Member since:
    Jul 2010

    Posted 28 Jul 2010 Link to this post

    hi telerik, 

    is this a vb code or c# code ? i am doing a vb project.

    Best Regard,
    ER AN
  7. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 28 Jul 2010 Link to this post

    Hello Eran,

    Yes, the code-snippet is in VB.NET.

    C# version
    protected void RadListView1_ItemCreated(object  sender, RadListViewItemEventArgs e)
    {
       if (e.Item is RadListViewDataItem)
       {
           Label label = e.Item.FindControl("Label1") as Label;
       }
    }

    VB.NET version
    Protected Sub RadListView1_ItemCreated(sender As Object, e As RadListViewItemEventArgs)
     If TypeOf e.Item Is RadListViewDataItem Then
      Dim label As Label = TryCast(e.Item.FindControl("Label1"), Label)
     End If
    End Sub

    Regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. malik
    malik avatar
    1 posts
    Member since:
    Aug 2010

    Posted 14 Aug 2010 Link to this post

     

    Dim LblUserID As Label = TryCast(e.Item.FindControl("lbluserid"), Label)

     



     

     

    Dim LblPhotoID As Label = CType(e.Item.FindControl("lblphotoid"), Label)

     

     

      i am not finding control of labels by both ways


    it gives nothing plz help.......

  9. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 19 Aug 2010 Link to this post

    Hello Malik,

    Please have a look at this link: Accessing Controls in RadListView

    If the problem still persists, please attach a runnable project and we will examine it locally.

    Regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017