How to bind a repeater on click on a row of another repeater?

Ok..So you know the particular id of row which the user clicks. In the click event get the id and pass it to your stored procedure or what ever way you are binding to the repeater. Check this below asp:Repeater ID="repGrd" runat="server"> ' OnCommand="clickbutton">Click Here Attributes"RowID".ToString().Trim(); // Write your code here to bind the repeater as you got the ID } catch(Exception ex) { } } #endregion Try this out.

Ok..So you know the particular id of row which the user clicks. In the click event get the id and pass it to your stored procedure or what ever way you are binding to the repeater. Check this below.. ' OnCommand="clickbutton">Click Here and the code behind goes like this.. #region On click of row binding repeater public void clickbutton(Object sender,CommandEventArgs e) { try { //Getting the ID of clicked row string RowIDval=((LinkButton)sender).

Attributes"RowID".ToString().Trim(); // Write your code here to bind the repeater as you got the ID } catch(Exception ex) { } } #endregion Try this out.

1 If you use the CommandArgument attribute of the LinkButton it would be easier to retrieve the id – Alan Stephens Nov 8 at 10:16.

I think this is what you are looking for: A UserControl that displays extended information about a Class. A web form with a repeater that binds on a collection of Class entities. The ItemTemplate of the repeater consists of a header for general class info and an instance of the UserControl we created with Visibility set to false.

We then turn this UC on/off depending on whether the user wants to see details. Some code: Entities public class Class { public int Id { get; set; } public string Name { get; set; } } public class ClassDetails : Class { public int NumberOfWeeks { get { return this. Id; } } } The ClassDetails User Control (aspx) Class Details: Number of Weeks: (code-behind) public void Populate(ClassDetails classDetails) { this.lblNumWeeks.

Text = classDetails.NumberOfWeeks.ToString(); } The WebForm (aspx) (.cs file) /// /// Page-level collection of Class instances /// List classes; /// /// The current class id we are displaying extended information for /// private int? ActiveId { get { if (this. ViewState"ClassIdDetails" == null) { return null; } else { return (int?)this.

ViewState"ClassIdDetails"; } } set { this. ViewState"ClassIdDetails" = value; } } protected override void OnInit(EventArgs e) { this.rptClassList. ItemDataBound += new RepeaterItemEventHandler(rptClassList_ItemDataBound); this.rptClassList.

ItemCommand += new RepeaterCommandEventHandler(rptClassList_ItemCommand); base. OnInit(e); } void rptClassList_ItemCommand(object source, RepeaterCommandEventArgs e) { //for now we know this is the only button on the repeater.So no need to check CommandType //set new ActiveId this. ActiveId = Convert.

ToInt32(e. CommandArgument); //re-bind repeater to refresh data this.BindData(); } /// /// For each Class entity bound, we display some basic info. /// We also check to see if the current Class is the ActiveId.

If it is, turn on the detail panel and populate the ClassDetailsUC /// /// /// void rptClassList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item. ItemType == ListItemType. Item || e.Item.

ItemType == ListItemType. AlternatingItem) { Class classItem = (Class)e.Item. DataItem; ((Label)e.Item.

FindControl("lblClassName")). Text = classItem. Name; ((Button)e.Item.

FindControl("btnShow")). CommandArgument = classItem.Id.ToString(); if (this.ActiveId. HasValue && this.

ActiveId == classItem.Id) { //we want to display details for this class ((Panel)e.Item. FindControl("pnlDetails")). Visible = true; //get ClassDetails instance ClassDetails details = this.

RetrieveDetails(classItem. Id); //populate uc ((ClassDetailsUC)e.Item. FindControl("ucClassDetails")).

Populate(details); } } } protected void Page_Load(object sender, EventArgs e) { //quick data retrieval process :) classes = new List { new ClassDetails() { Id = 1, Name = "Class 1" }, new ClassDetails() { Id = 2, Name = "Class 2" }, new ClassDetails() { Id = 3, Name = "Class 3" } }; if (!this. IsPostBack) { //only bind on initial load this.BindData(); } } private void BindData() { this.rptClassList. DataSource = this.

Classes; this.rptClassList.DataBind(); } /// /// Quick function to simulate retrieving a single ClassDetails instance /// /// /// private ClassDetails RetrieveDetails(int id) { return this.classes. Where(c => c. Id == id).Single(); }.

A repeater on click on a row is bound (without quotes):. Bind a repeater on click on a row.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions