This is a migrated thread and some comments may be shown as answers.

FindControl

7 Answers 100 Views
ListView
This is a migrated thread and some comments may be shown as answers.
eran
Top achievements
Rank 1
eran asked on 25 Jul 2010, 10:02 AM
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

7 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 26 Jul 2010, 09:16 AM
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
0
eran
Top achievements
Rank 1
answered on 26 Jul 2010, 09:57 AM
hi telerik,

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

Best regard,
ER AN
0
Daniel
Telerik team
answered on 26 Jul 2010, 12:30 PM
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
0
eran
Top achievements
Rank 1
answered on 28 Jul 2010, 06:07 PM
hi telerik, 

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

Best Regard,
ER AN
0
Daniel
Telerik team
answered on 28 Jul 2010, 09:15 PM
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
0
malik
Top achievements
Rank 1
answered on 14 Aug 2010, 08:10 AM

 

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.......

0
Daniel
Telerik team
answered on 19 Aug 2010, 09:54 AM
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
Tags
ListView
Asked by
eran
Top achievements
Rank 1
Answers by
Daniel
Telerik team
eran
Top achievements
Rank 1
malik
Top achievements
Rank 1
Share this question
or