By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,971 Members | 900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,971 IT Pros & Developers. It's quick & easy.

Is it possible to create editable drop down list using ASP.NET?

P: 2
Is it possible to create editable drop down list using ASP.NET?
Mar 25 '07 #1
Share this Question
Share on Google+
2 Replies

P: 1
Yes it is, go to this site. he has a link to download the C# code.
May 10 '07 #2

P: 2
u can use textbox and dropdown list to make editable dropdown list

<asp:DropDownList ID="dropdown" runat="server" Font-Bold="True" Style="z-index: 100;

left: 222px; position: absolute; top: 341px" Width="239px" Height="23px" Enabled="False" AutoPostBack="True" OnSelectedIndexChanged="ddlHandlerRouteName_Select edIndexChanged">
<asp:ListItem>----New Item?----</asp:ListItem>




----------------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>

whn user click on new item show textbox and hide drop down and when he write new item in textbox then add tht item in drop down and make it visible

protected void dropdown_SelectedIndexChanged(object sender, EventArgs e)

if (this.dropdownSelectedIndex == 0)

this.textbox.Text = "";
this.dropdown.Visible = false;

this.textbox.Visible = true;


protected voidtextbox_TextChanged(object sender, EventArgs e)

int index = 0;if(!this.dropdown.Items.Contains(new ListItem(this.textbox.Text.Trim())))


for (int i = 0; i < this.dropdown.Items.Count; i++)

if (dropdown.Items.Text == this.textbox.Text)

index = i;



this.dropdown.SelectedIndex = index;
this.dropdown.Visible = true;

this.textbox.Visible = false;
Oct 24 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.