changing state of drop down list

Discussion in 'ASP .Net' started by luna, Jan 28, 2004.

  1. luna

    luna Guest

    is there a way of changing the state of a drop down list to a text box
    depending on criteria ?
    i could create a drop down list and a text box list in the same posistion
    and change the visibility on criteria
    - just wondered if there was another way

    thanks
     
    luna, Jan 28, 2004
    #1
    1. Advertising

  2. luna

    Madan Nayak Guest

    You create the controls at run time rather in the design time....

    You can try that....

    "luna" <> wrote in message
    news:GVPRb.212$...
    > is there a way of changing the state of a drop down list to a text box
    > depending on criteria ?
    > i could create a drop down list and a text box list in the same posistion
    > and change the visibility on criteria
    > - just wondered if there was another way
    >
    > thanks
    >
    >
     
    Madan Nayak, Jan 28, 2004
    #2
    1. Advertising

  3. luna

    Curt_C [MVP] Guest

    no, they are two different controls, you can 'transform' one into the other.


    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    www.Darkfalz.com


    "luna" <> wrote in message
    news:GVPRb.212$...
    > is there a way of changing the state of a drop down list to a text box
    > depending on criteria ?
    > i could create a drop down list and a text box list in the same posistion
    > and change the visibility on criteria
    > - just wondered if there was another way
    >
    > thanks
    >
    >
     
    Curt_C [MVP], Jan 28, 2004
    #3
  4. luna

    Shahar Guest

    Sure

    // HTML
    <form id=frmMain method=post runat="server">
    <asp:panel ID="pnl" Runat="server">
    </asp:panel>
    </form>

    // Code
    private void Page_Load(object sender, System.EventArgs e)
    {
    if (true)
    {
    DropDownList list = new DropDownList();
    list.Items.Add(new ListItem("text", "1"));
    list.Items.Add(new ListItem("text", "2"));
    pnl.Controls.Add(list);
    }
    else
    {
    TextBox txt = new TextBox();
    pnl.Controls.Add(txt);
    }
    }
     
    Shahar, Jan 28, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SirPoonga
    Replies:
    2
    Views:
    781
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,033
    weiwei
    Jan 5, 2007
  3. Replies:
    5
    Views:
    282
  4. JRough
    Replies:
    0
    Views:
    306
    JRough
    Oct 7, 2009
  5. JRough
    Replies:
    3
    Views:
    331
    Evertjan.
    Oct 7, 2009
Loading...

Share This Page