.Net Help - Dynamically Adding Components

Discussion in 'Software' started by alag20, Nov 8, 2006.

  1. alag20

    alag20 Private E-2

    Hi,
    I am having a bit of trouble in c# .NET.

    It is a simple code. I have made a small reg form which needs to contains a few checkboxes for interest depending on number on interest enteries in a database.

    Now my problem is :-
    1. How do I add the components(- Checkboxes) into ASPX from code behind file.
    2. How do I handle and get the values when the user clicks submit.

    My form just posts back to same page for validation and database update!

    Any help would be highly appreciated!
     
  2. alag20

    alag20 Private E-2

    Hi,
    I have just located that I can do that with a repeater. however if anyone has a better solution then please let me know!
     
  3. Kodo

    Kodo SNATCHSQUATCH

    You could put a panel on the page and loop through however many times you need to to get your check box count.

    for(int i=0;i<somethingCount;i++)
    {


    this.myPanel.Controls.add( //add new textbox control here)
    }
    make sense?
     
  4. alag20

    alag20 Private E-2

    Thanks Kodo. But then how do i get the values entered by the user from thoese new text boxes?
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds