Click "Mark as Answer" on the post that helped you.
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
Re: Finding Template Control in teleRik grid in ItemCreated Event
May 26, 2010 02:26 AM|incubator138@hotmail.com|LINK
Hello Varun,
Since you have placed the ListBox in ItemTemplate of GridTemplateColumn, you need to check for GridDataItem in order to access the control. Here is the code example.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if ((e.Item is GridDataItem))
{
GridDataItem dataItem = (GridDataItem)e.Item;
ListBox listBox1 = (ListBox)dataItem.FindControl("ListBox1");
// Now you can simply set the properties of ListBox from here
// listBox1.Visible = false;
}
}
Member
210 Points
131 Posts
Finding Template Control in teleRik grid in ItemCreated Event
Dec 29, 2009 04:02 AM|varunpals|LINK
Hi to all
I have a listbox in TemplateField in a telerik Grid. ListBox is in Item Template. How can i find it in Item Created Event of Grid.
Regards
Varun Anand
Member
10 Points
4 Posts
Re: Finding Template Control in teleRik grid in ItemCreated Event
Dec 29, 2009 08:39 PM|s_molam|LINK
Hi,
You can do this the same as will any templated control:
Depending on what type of item each row is though you might need to check first that it isn't a header or footer or edit item.
Cheers
Sean
telerik
(Developer)
www.zimweb.com.au
Telerik MVP
All-Star
44551 Points
13496 Posts
MVP
Re: Finding Template Control in teleRik grid in ItemCreated Event
Jan 01, 2010 11:59 AM|TATWORTH|LINK
If you require more detailed help on Telerik controls, please ask at:
http://www.telerik.com/community/forums.aspx
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
Member
102 Points
55 Posts
Re: Finding Template Control in teleRik grid in ItemCreated Event
May 25, 2010 01:30 AM|manish_partey|LINK
Hi,
Try this way
foreach (GridDataItem row in grvSearch.MasterTableView.Items)
{
Label labelPrice = (Label)row["Column Unique Name"].FindControl("Control ID");
Label lblTotalPrice = (Label)row["Column Unique Name"].FindControl("Control ID");
}
=====================
Manish
Please mark as answer if it help you.
Member
140 Points
70 Posts
Re: Finding Template Control in teleRik grid in ItemCreated Event
May 26, 2010 02:26 AM|incubator138@hotmail.com|LINK
Hello Varun,
Since you have placed the ListBox in ItemTemplate of GridTemplateColumn, you need to check for GridDataItem in order to access the control. Here is the code example.
C#:
Cheers,
Shinu.