Textbox into Dropdown list in ASP.Net C#

Leave a Comment

  • First we have to take 1textbox,2 buttons and 1 dropdownlist .
  • textbox for entering value 
  • 2 buttons one for add the values and second for removing values from dropdownlist



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DropDownList1.Items.Add(TextBox1.Text);
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        DropDownList1.Items.Remove(TextBox1.Text);
    }
}

Texbox into Dropdownlist

0 comments :

Post a Comment

Contact Us