C# .NET - Get value of label from parent Repeater Control in Child Repeater
Asked By Jem Savery
21-Jun-10 06:57 AM
Hello,
I am using nested repeater controls in my page. In first repeater I have two values ClassId and ClassName.
And there is another repeater inside this repeater.
In the child repeater I want the value of ClassID(which is in parent repeater). How can I get this?
I have already tried
Repeater parent = e.Item.Parent as Repeater; //but didn't work.
Can anybody help?
Shailendrasinh Parmar replied to Jem Savery
Ok, you can do this in following way
RepeaterItem rptItem = (RepeaterItem)e.Item.NamingContainer.NamingContainer;
Label lblclassid = rptItem.FindControl("lblClassID") as Label;
string classId = lblclassid.Text;
Hope this helps.

data repeaters how do i access this particular column in the repeater row from code behind ? <asp:repeater. . . . < ItemTemplate > < tr > < td > < / td > < td > <% # DataBinder.Eval(Container.DataItem, "SN" )%> . < / td > . . . . . when the values are bound to a label or amy web control i am using findcontrol. . but with values that are directly put into the table, i dont understand how to Text Attribute. Since this will be runat = server, you will now be able to use FindControl. Don't forget that multiple rows will have different ID's for the Label, So side anymore. Hi, try the following article and it solves your answer. . . The ASP.NET Repeater is a basic container control that allows you to create custom lists from any data available to the page. It's a handy control, especially since most ASP.NET pages that display data need to repeat the same kinds
Creating Rich Repeater Control By Hendrik Swanepoel Creating a Functionally Rich Repeater Control By Hendrik Swanepoel Introduction: Download C# Source Code We're all familiar with the bundled controls provided with asp.net. The most frequently used databinding controls are the datagrid and repeater. The datagrid is used where tabular data needs to be displayed. The repeater is used for any unstructured databinded repeating - even in a horizontal manner. Both of these large projects. Certainly you can use inheritance to derive from the datagrid and use that control everywhere? When you need to make a functionality change or a change in the layout of the control, you can then change it in the derived control only once? This is a real
how to get parent repeater values in a child repeater Hi. . i need to get a text value of parent repeater using in child repeater. how can i do this pls help me Try this Repeater ParentRepeater = ( Repeater )Page.FindControl( "ParentRepeater" ); Yes, it's possible. . "OnitemCommand" of repeater you can access value. . . protected void parentRepeater_OnitemCommand(object sender, RepeaterItemEventArgs e) { protected void parentRepeater_OnitemCommand(object
How can I bind control to repeater? I want to bind Label to repeater. I have to display on label the Expertie from EpertiesTable of Database. Here are lines of code which I write: foreach (RepeaterItem item in rptAreasOfExperties.Items) { if (item.ItemIndex = = 0) { RepeaterItem headerItem = new RepeaterItem(item.ItemIndex, ListItemType.Header); HtmlGenericControl htm = new HtmlGenericControl("h4"); htm.InnerHtml = AreaOfExperties.ColumnNames.Expertise; item.Controls.Add(htm); } RepeaterItem repeaterItem = new RepeaterItem(item.ItemIndex, ListItemType.Item); Label Label1 = new Label(); Label1.Text = string.Format("{0
Dynamic Repeater binding Hello How can we bind repeater dynamicall from the basis of a table( Means table coloumn name is should be Repeater header ), , That will be linkbutton or labels. . .But I did some thing from the help be change). . Anyone can help me Harikrishnan.S India HTML Code to Generate ASP.Net Repeater Control Dynamically < asp : Panel ID = "Panel1" runat = "server"> < / asp : Panel > Only ASP.Net Panel control is required. C# Code to Generate ASP.Net Repeater Control Dynamically / / Repeater Control Databinding using Datasource Repeater Repeater1 = new Repeater(); Repeater1.DataSource = myDataSet; Repeater1.DataBind