Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6364485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:10:10+00:00 2026-05-25T00:10:10+00:00

I have a webform which dynamically loads a web user control in it. Within

  • 0

I have a webform which dynamically loads a web user control in it. Within the web user control is a repeater control, and the web user control can be dynamically created within it self as many times as needed, all of these are loaded into a placeholder.

eg:

webusercontrol1
   repeater
   webusercontrol
      repeater
   webusercontrol
      repeater
      webusercontrol
         repeater

When I loop through the controls within the placeholder, the only repeater that comes up is the first repeater.

my code is as follows:

protected void cmdsave_Click(object sender, EventArgs e)
{
    foreach ( Control ctl in this.officephld.Controls )
    {
        if ( ctl.GetType().ToString() == "ASP.evalctl_ascx" )
        {
            foreach ( Control sctl in ctl.Controls )
            { GetRatingControl(sctl); }
        }
    }
    Response.Redirect("~/contractoreval.aspx?sc=1");
}
protected void GetRatingControl(Control item)
{
    Repeater rpt = (Repeater)item.FindControl("rptPts");
    foreach ( Control ctl in rpt.Controls )
    {
        if ( ctl.GetType().ToString() == "System.Web.UI.WebControls.RepeaterItem" )
        {
            RepeaterItem ri = (RepeaterItem)ctl;
            HiddenField pntid = (HiddenField)ri.FindControl("pntid");
            HiddenField catid = (HiddenField)ri.FindControl("catid");
            HiddenField rating = (HiddenField)ri.FindControl("rating");
            if ( pntid != null && catid != null )
            {
                AjaxControlToolkit.Rating rtg = (AjaxControlToolkit.Rating)ri.FindControl("pntrating");
                SQLConnectivity db = new SQLConnectivity();
                SqlParameter[] param = new SqlParameter[8];
                int iRetValue = 0;

                param[0] = db.MakeInputParameter("@eval_id", Convert.ToInt32(pntid.Value));
                param[1] = db.MakeInputParameter("@category_id", Convert.ToInt32(catid.Value));
                param[2] = db.MakeInputParameter("@organization_id", 1);
                param[3] = db.MakeInputParameter("@subcontractor_id", 1);
                param[4] = db.MakeInputParameter("@project_id", 1);
                param[5] = db.MakeInputParameter("@rating", Convert.ToInt32(rating.Value));
                param[6] = db.MakeInputParameter("@created_by", 1);
                param[7] = db.MakeInputParameter("@updated_by", 1);
                db.RunNonQueryProcedure("PerformanceSubcontractorEvalSave", param, ref iRetValue);
            }
        }
    }
}

EDIT
for the repeater, this hiddenfield rating is only being instatiated on the first repeat control, the following is my HTML markup:

<asp:Repeater ID="rptPts" runat="server" Visible="false" 
    onitemdatabound="rptPts_ItemDataBound">
    <HeaderTemplate></HeaderTemplate>
    <ItemTemplate>
        <div style="width:75%;float:left;padding-top:3px;height:20px;">
            <asp:Label runat="server" ID="Label1" Text='<%#DataBinder.Eval(Container.DataItem, "eval_description") %>' Font-Names="Arial" Font-Size="10px"></asp:Label>
        </div>
        <asp:HiddenField ID="catid" runat="server" />
        <asp:HiddenField ID="pntid" runat="server" />
        <asp:HiddenField ID="rating" runat="server" />
        <div style="width:20%;float:right;padding-top:3px;padding-bottom:3px;height:20px;">
            <cc1:Rating ID="pntrating" runat="server" FilledStarCssClass="filldStar" OnChanged="pntrating_Changed" EmptyStarCssClass="emptyStar" StarCssClass="filldStar" WaitingStarCssClass="savedStar" EnableViewState="true" AutoPostBack="false" BehaviorID="ratingControlBehavior">
            </cc1:Rating>
        </div>
        <div style="clear:both;"></div>
    </ItemTemplate>
    <FooterTemplate></FooterTemplate>
</asp:Repeater>

how can I loop through the various levels of repeater control and get the repeater items within this setup?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:10:10+00:00Added an answer on May 25, 2026 at 12:10 am

    You aren’t going deep enough into the child controls.

    Firstly change this line

    if ( ctl.GetType().ToString() == "System.Web.UI.WebControls.RepeaterItem" )

    to this

    if ( ctl is RepeaterItem )

    as what you have is ugly.

    then make a change to GetRatingControl to recursively call itself for each control that is a RepeaterItem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webform which dynamically loads a web user control in it. Within
I have an ASP.NET webform on which I use a DropDownList control to allow
I have an ASP.NET web form which I am adding a variable number User
I have a web form where I have a textbox in which the user
In WinForms, I can design a form and have a TabValue to control which
I have a WebForm with 4 combo boxes, which allow user to define different
I have a webform which uses a gridview control to show result of a
In my webform I have a repeater control. I have a button to open
I have a webform that allows users to dynamically add 'sections' (which are divs
Imagine we have a webform page with a dynamically created checkbox and date time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.