dynamically updating user controls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pinman
    New Member
    • Aug 2008
    • 20

    dynamically updating user controls

    hi. i'm using ASP.NET 3.5 with c#. my problem is that i have created a user control and want to dynamically add mulitple instances of these controls to the web form.
    when a user adds data to one of the user controls i then need to carry out some calcaulations, change the current user control data and then alter all the other user controls to different values(ignoring the one just changed). i then need to alter some of the controls on the main page outside of any user control.
    i've no real idea how to do this. i've thought about exposing an event in the user control to pass values up to the page. the page then carries out the processing to non 'user-control' controls then drills down to each user control in turn(all user controls are in a placeholder control). but that would be a pain retrieving all the HTML element id's etc....hope that wasn't abit rambling lol.
    any help would be appreciated
  • pinman
    New Member
    • Aug 2008
    • 20

    #2
    had a thought. if i define public properties for the user control, can i then use this property as the value for one of the user controls subcontrols value? when i then access and change this property will the subcontrols data automatically change to the new value?

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Check out this article on how to use dynamic controls in asp.net. Near the end of the article you will see a section on how to dynamically create User Controls.

      -Frinny

      Comment

      Working...