locked
Controls collection is empty but rendering all controls to the page. - ITemplate - Repeater Control RRS feed

  • Question

  • User1552295847 posted

    Hi Folks,

    Summary: I am trying to design a scenario where, pulling information (random columns and random columns number) from SQL, also based on column data type, binding different type of controls (Label, TextBox, etc...) to the Repeater.

    1. In the ASPX page, took only repeater control server tag.
    2. Written a CenterTemplate class inherited from "System.Web.UI.ITemplate", where  i am writing code to initialize Header, Footer and Item template in "InstantiateIn(System.Web.UI.Control container)"
    3. based on item data type i am binding different controls (Lable, TextBox, etc...) to placeholder control (reference example: https://msdn.microsoft.com/en-us/library/0e39s2ck.aspx
    4. on ASPX page load, pulling information from SQL server and binding it to the control.

    Page is getting loaded as expected, but the problem statement is, I am not able to get the control back on a button click event to save the updated data to SQL, it is showing control collection count is 0.

    do let me know for more clarification.

    Regards,

    Avinash

    Thursday, March 8, 2018 6:23 AM

All replies

  • User61956409 posted

    Hi Avinash,

    not able to get the control back on a button click event to save the updated data to SQL

    Do you try to rebind your repeater with datasource after you click update button? Please share your relevant code, which can help reproduce the issue.

    With Regards, 

    Fei Han

    Friday, March 9, 2018 2:21 AM