Sara Chipps
Sara Chipps

Reputation: 9372

Ajax dropdown limit to list

pretty much what the title says.

I am using an Ajax Drop Down as illustrated here:

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/DropDown/DropDown.aspx

using linkbuttons ... is there a way to limit to list?

Thank you.

Edit: I think it was VB 6 maybe that you could select "LimitToList" in a drop down. Meaning the user can only select the values in the drop down and not enter his own data.

Upvotes: 2

Views: 1134

Answers (1)

FlySwat
FlySwat

Reputation: 175653

Since you're extending a textbox, I think the best option would be to attach an event listener that voids keypresses, you could do this in the ASPX:

<asp:Textbox id="txtFoo" onkeypress="return false;" runat="server"/>

Or, in the code behind:

txtFoo.Attributes.Add("OnKeyPress","return false;");

This will prevent a user from typing in the textbox, essentially creating the effect you want.

A bonus side effect is that a user is allowed to free type an entry if javascript is disabled and the dropdown extender doesn't work.

Upvotes: 2

Related Questions