AJAX :: Show/hide The Text Box Depending On The Text Of The Selected Item In The Combo Box?
Nov 13, 2010
I have a .net 3.5 web form with an ajax combo box and a text box inside it. The bombo box is bound to a SqlDataSource.
My requirement is to show/hide the text box depending on the text of the selected item in the combo box. If a particular string, say 'xyz', appears in the text of the selected item, the I will make the text box invisible. I enabled the AutoPostback, made the text box disappear in the SelectedIndexChanged event, and everything worked fine.
However, when users enter their own texts (which are not in the list items), I am unable to show / hide the text box. I've tried the TextChanged event but nothing happens. It seems the event is not trigger after I enter a new text and locate the focus to other place.
is there a way to prevent the user ented text from being inserted into the bombo box?
I have 1 drop down, 1 text field and 1 command button i.e. "Search". Dropdown contrains following values
Type1 Type2 Type3
In textbox user will enter numeric or alphanumeric value
Here I want to check if 'Type1' is selected so user can enter only numeric value between 1000 and 2000, otherwise display some message "Entered value is not valid for "Type1". I want to display this message thru required validator error message property
If user select 'Type1' and 'Type2' then user can enter any alphanumeric value other than 1000-2000 numeric range.
I want to implement thru Search button or once user leave the textbox after entering value. Here I want to display message.
Can I provide a Combobox that will EITHER let a user type in a value OR let them select from the dropdown? I am trying to create a scenario where a user can attach a value to an object they are editing. When attaching that value, I want them to be able to type in a completely new value or, select from a list of already-existing values.
When I create the combo box, I add a list item that has text like "Type a value or pick from the list"...this has an index of 0. Then I append the databound values to the list.
A combo box seems like the perfect solution since it combines a text box with a drop down list but, I can not figure out how to retrieve the text that has been typed into the combobox once the form is submitted. cmbMyComboBox.text seems to be the obvious way to do it but, that returns an empty string. If I try to get the SelectedItem.Text then, I get "Type a value or pick from the list" instead of whatever text I typed into the combobox, once it was displayed.
Am I trying to do something that the ComboBox is not meant to do? How can I accomplish this?
I have decided to abandon trying to use the combo box. I am trying to use a dropdown menu in one column, and text boxes in all the others. But, I am having a strange problem with that as well. I will post those problems in the appropriate forum. I marked this post as "No Status" because I didn't see any way to delete it.
I have an Ajax Toolkit combo box in DropDownStyle Mode. The DropDownStyle should prevent the user from entering values that are not in the list of items of the combo box. The problem is, if the user paste some text (right-click --> past OR ctr + V) in the combo box, it will work, event if the pasted text is not the list of items. Is there a way I can prevent this?
I am using the combo box for my project and I am having some odd behaviour from combobox...
i am using this combobox inside a formview control...once i click on combobox it is showing the list items at the bottom of formview not next to combobox control...I think it is taking the top and left values from formview offset.
I have a dropdown list which include "yes" and "no". When I click "yes", then there have to be 2 text boxes visible, just below the dropdownlist. If the user selects "no" in the dropdownlist, then the 2 text boxes have to disappear again.
So at the moment I have a literal to which I assign a value to from database. I.e an Introduction to a programme.
I am creating an MVC project with a table using the JQGrid plugin. I would like to use a DropDownList to allow the user to specify a value, that will be used in an SQL query to retrieve specific data from the table. I.e. user can select a country from the list, and the table will display items only from that country. I cannot figure out how to retrieve the selected item from the DropDownList, within my data bind function for my table, within my controller class.
DropDownList in the View
Setting up the DropdownList in my controller
//dt is a DataTable which holds the values for my list List<SelectListItem> countries = new List<SelectListItem>(); for (int i = 0; i < dt.Rows.Count; i++) [code].... The problem seems to be that within a JsonResult function I don't have access to the ViewData or my ViewModel, which always seem to be null when I try and access them. I am very new to MVC and web development,
I have one label and one dropdownlist which contain "red" and "blue". When I select "red" from dropdownlist, the label will display "You select RED" and if I select "blue", it will display "You select BLUE". The text is display immediatelly after selected without using BUTTON.
I have try to put the codes in Page_Load but not functioning, below is my code:
Can anyone guide me how to do this and I'm using C#?
I am using frames in my webpage.in one of the frames i have a menu control whose items are database driven.when click on the menu item, i want another page to be displayed in other frame. now i want to pass the the selected menu item text to the other page using session variable which is in the menu item click event method.but the thing is when i click on the menu item, the click event is not firing. is there any better way to pass the selected menu item text to the other page?
New users can register on my site by completing a basic form that has the create user wizard control with some additional information i am collecting using a CheckBox List. They can then log in to the site and and view "MypProfilePage.aspx" where I display the information with the CheckBoxList boxes already ticked based their selections which they can update. My problem is I have two levels of User and each one has a different registration form.
Registration Form A Has 20 Items in the CheckBox List
Registration Form B Has 10 items in the CheckBox List
On the Profile Page, I just want to show the CheckBox which is relevant to the Registration form A or B and with selections by the registered user. So therefore the User who registered on B will not be able to see the selections checkbox list for A.
List controls deriving from ListControl, such as DropDownList, ListBox or RadioButtonList, are populated by a list of ListItems. A ListItem has a Value and a Text property.
ListControl offers the following methods to access the currently selected item:
ListControl.SelectedItem returns the currently selected ListItem, ListControl.SelectedValue returns the Value property of the currently selected ListItem.
Now, the interesting thing is:
ListControl.Text returns exactly the same value as ListControl.SelectedValue. It does not return SelectedItem.Text, as one might expect.
This is by design:
The Text property gets and sets the same value that the SelectedValue property does.
This seems counter-intuitive and confuses people. My question is: Why was it done this way? I can imagine that providing a Text property is necessary for implementing the ITextControl interface, but why on earth would you choose to have it return the Value of the ListItem rather than the Text?