You must Sign In to post a response.
  • Category: ASP.NET

    AutoGenerated REPEATER control asp.net c#

    Guys,

    There is a Repeater inside a Repeater which is inside a main Repeater.
    (Main Repeater --> Child Repeater --> Sub Child Repeater) .

    When we reads it from source file during runtime, the repeater name is as below,

    ctl00_MainContent_ReportRP_ctl01_ContentTypeRP_ctl00_ContentRP

    ctl00_MainContent_ReportRP_ctl02_ContentTypeRP_ctl00_ContentRP

    From the above, we can understand ContentRP is single repeater but it will be repeated twice (which is in another Repeater) which will be having a check box in each row.

    Now i want to validate the check boxes (one or more) in both repeaters respectively are checked true and if checkboxes in both repeaters are found checked TRUE, i should make the checkboxes checked FALSE in one Repeater . I mean only one Repeater should have check box (one or more) checked TRUE at a time.

    Please help me to do this.
  • #767657
    Please find the screenshot of repeaters of above post.

    Delete Attachment

  • #767660
    Hi

    Find Control for this try this code



    ((MyParentUserControlTypeName)NamingContainer).Property1 = "Hello";

    CheckBox chk1= this.FindControl("parentPanel").FindControl("childPanle").FindControl("checkBox1") as CheckBox;


    private static Control FindControlParent(Control control, Type type)
    {
    Control ctrlParent = control;
    while((ctrlParent = ctrlParent.Parent) != null)
    {
    if(ctrlParent.GetType() == type)
    {
    return ctrlParent;
    }
    }
    return null;
    }


    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #767662
    Hi,

    As per my understand ?I have one question here, only one checkbox is checked either in parent or child then how it is helps you to incorporate your requirement?

    Ex: you are selected Parent checkbox then without select child checkbox why are you implement checkboxes in child control, what is the exact condition? please elaborate more...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #767665
    Hai Rajabharathi,
    It's better that you make the id's as unique and should not be generated by the system. Use ClientIdMode="Static" for each of the repeater controls. This property of the control will make the Id's as unique as run-time and will not be auto-generated.
    Once you apply this property to the controls, you can access them using Find() method inside another controls like below:

    CheckBox myCheckBox=(CheckBox) this.FindControl("mainRepeater").FindControl("childRepeater").FindControl("innerChildRepeater").FindControl("checkBox1");
    if( myCheckBox != null)
    {
    // do your stuff.
    }

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


  • Sign In to post your comments