getting first index value from dropdown list - asp.net

I need to display the grid View populated with some data on selected index change event of a Drop Down List .
It will be fine when selecting other index values from the drop down list at first time.
but when selecting first index value at first time ,the selected value returns nothing.
how to get the selected value from the drop down list on first click.

Don't set SelectedValue or SelectedIndex while populating/binding the DropDownList.

Related

How to capture removed item in AsyncTypeahead when removing item from the list

bootstrap-typeahead for add multiple items to a list.
https://github.com/ericgio/react-bootstrap-typeahead
I need to pick the value, when I remove an item from the list.
onChange event of the AsyncTypeahead handling the event when removing and adding items to the list.
When an item removed, selected data updating with the existing values in the list.
Eg: I have 3 items in the list, I am removing an item, Then the selected list containing existing items. (2 items)
In my project I want to get that removed item, at the time of removing.
Is there any functionality for pick that removed value in "onChange" event.
I had the same problem, and I get it sorted in this way:
Compare your current selected items with the selected items that you had before onchange.
eg:
const removedItem = this.state.alradySelectedItems.filter(value => !selected.includes(value));

Java FX 8 Tablecell data to Listview selected data

I have a Java FX TableView with a column. This column is pre-populated with values from a database. When I click a cell on the table a listview is shown, I can update the table cell and the DB by selecting the values from the list.
Before the listview shows up, I set the selected value of the list to match the existing table cell's value by the following
listView.getSelectionModel().select(this.getItem());
when the list view opens the selected item corresponds to the cell value of the table.
I have a onchangelistener attached to the listview's selectedItemProperty.
From this list view if I choose a new value, When the selection changes the DB gets updated and the table cell gets updated with the new value.
If there is a problem with the database update, the listview's selected ItemProperty still retains the newly selected value.
I have tried resetting it using
listView.getSelectionModel().select(this.getItem());
but this doesn't reset the selectedItemProperty value.
Hence if you click the same cell once again, the list is having the previously selected value highlighted (i.e the value which was not updated due to a DB failure) the table cell and the selected value in the listview are different.
How do I overcome this ?

Refresh drop down list

I have a drop down list that is populated based on the selected value of another drop down list. The main drop down list is dlJobName. It contains the list of all active jobs. The second drop down list is dlStage. This contains the distinct stage values related to the JobName. Here is the query that populates the dlStage drop down list.
SELECT DISTINCT [AnnotationDate] as Annotation_Date FROM [vw_GridviewSource] WHERE ([Name] = #Name)
In this code the AnnotationDate is not a date field but a text field. #Name is a variable equal to the selected value from the dlJobName list.
Here is my dilemma. When I make a selected_index_change event for the dlJobName, before I update the gridview that uses both of these drop down lists, I need to update the dlStage to only available values. What is happening is the dlStage list is not updated and the values in the drop down list is not available for the new JobName. Is there a way to force the query to run on the dlStage drop down list in conjunction with the selected index change event? This would cause the gridview to at least populate and not error out.
I can provide whatever additional code is necessary.
I think you have not set AutoPostBack="true" of drop down list. If Problem continues please put your HTML and cs code for proper help.
Hi maybe like other user comment you need go to property from dropdownlist, search AutoPostBack and change False for True. Don't forget clean firsr your dropdownlist
DropDownList.Items.Clear() (VB.NET)
DropDownList.Items.Clear(); (C#)
After clean your dropdownlist charge again your method to bind dropdownlist
set the property
dlJobName.AutoPostBack="true"
This will makes the SelectedIndexEvent to fired when the selected index of the main dropdown is changed.
In that selectedIndexChanged Event load the second DropdownList.
Here is an example,
http://asp-net-example.blogspot.in/2009/03/how-to-use-dropdownlist-autopostback.html
Hope your problem solved, if still exists kindly paste your snippet.

DevExpress RowUpdating old values returning text value

I have a DevExpress ASPXGridView which has been bound with a dataset.
I'm using the edit row command to edit the data in the row and return it to the database.
When the edit button is clicked, the row opens up and there is an ASPXComboBox that is bound to another dataset. The TextField and the ValueField have both been properly set in the ASPXComboBox and are displaying data correctly. The data is as shown
List item
List item
When e.NewValues("") is called the integer value field i.e 1 is returned. However, when e.OldValues("") the TextField is returned i.e. "List Item"
Is there a way of returning the the integer value when calling e.Oldvalues without having to make another call to the database?
Thanks

incrementing the number of times a list component is clicked?

I have a list component that lists certain items..
so, if i click on a certain item..i should get the index this way :
var clickedIndex:int = listID.selectedIndex;
but how can i count the number of times the variable clickedIndex has been selected?
so, if a user keeps clicking on the index[0], i want to know how many
A couple ideas off the top of my head (I'm assuming your List dataProvider is an ArrayCollection):
Modify the Object you're using in the ArrayCollection for your list's dataProvider to include a clickCount property. When an item is selected in the list, increment the clickCount property. This will keep the correct number of clicks for each item if your ArrayCollection gets sorted or filtered and the indexes change.
Create an Array variable to store the click counts for each index in your ArrayCollection. Then you would increment the number the the Array's index that matches the ArrayCollection's selectedIndex.

Resources