Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

how to dynamically create controls? ASP.NET

  • 19-06-2006 12:12PM
    #1
    Moderators, Society & Culture Moderators Posts: 2,687 Mod ✭✭✭✭


    How would i do this....

    Ive a dropdown list, contains numbers 1 - 10.

    ive ten textboxes hidden underneath it.

    Depending on the number chosen i show same number of textboxes.

    Anyone know how to do this client side only?:confused:


Comments

  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    If you want it clientside, use javascript or somesuch scripting language.


  • Registered Users, Registered Users 2 Posts: 1,454 ✭✭✭Smoggy


    isnt it as straight fwd as adding a sub to the selectedindex event of the drop down that says something like :

    sub showbuttons(byval intSelectIndex as integer)

    if intSelectIndex >= 0 then

    button1.visible = true

    end if

    if intSelectIndex >= 1 then

    button2.visible = true

    end if


  • Closed Accounts Posts: 47 Lucifer 2


    This is reasonably easy if you're willing to postback to the server. You can set AutoPostBack="true" on the drop down list so when they make a selection the page refreshes with the correct number of text boxes displayed. However doing this in javascript is probably more tricky, i.e. I don't know how to do it.

    Finally, for an AJAX solution consider Atlas (http://atlas.asp.net). This provides the resonsiveness of client side with the programming model of server side :-)


Advertisement