Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

how to dynamically create controls? ASP.NET

Options
  • 19-06-2006 12:12pm
    #1
    Moderators, Society & Culture Moderators Posts: 2,688 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 Posts: 1,466 ✭✭✭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