Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dropdownlist for option, but still can type in other options

Status
Not open for further replies.

kaijanm

Programmer
May 14, 2003
102
US
Hello, thanks in advance for any help.

I have a drop down list on a page for a user to select from, but I also need them to be able to type in a value that isn't in the list. 99% of our customers are in NM, so I have a list of NM cities, but I need them to be able to type in a city in another state on rare occasions. This seems like a simple thing, but I haven't yet been able to figure it out.

Thank you!
Kimberly
 
What I would look into is the theory of two controls - A textbox and a dropdown or listbox.

What I have done in the past is used the textbox value to limit the choices in the listbox but they can type something else in if necessary. OnSelect on the list, I set the value to the textbox.

HTML...
Code:
								<asp:TemplateColumn HeaderText="City">				<ItemTemplate>							<asp:Label id="lblCity" runat="server" Width="338px" Text='<%# DataBinder.Eval(Container, "DataItem.City_VC") %>'>						</asp:Label>					</ItemTemplate>						<EditItemTemplate>						<asp:TextBox id="txtCity" runat="server" Width="338px" Font-Size="10px" Font-Names="Arial" AutoPostBack="True" Text='<%# DataBinder.Eval(Container, "DataItem.City_VC") %>' OnTextChanged="GetCityFiltered">
			</asp:TextBox><BR>					<asp:ListBox id="lstCity" runat="server" Width="338px" AutoPostBack="True" DataValueField="City_VC" DataTextField="City_VC" OnSelectedIndexChanged="SetTextField" Rows="4"></asp:ListBox>
		</EditItemTemplate>				</asp:TemplateColumn>

Hope this helps.

Hope everyone is having a great day!

Thanks - Jennifer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top