selectedindexchanged

Why selected index fires only once the Index of the ListItem is changed?

心已入冬 提交于 2019-12-11 07:29:29
问题 Consider a asp:dropdownlist which fires SelectedIndexChangedEvent based on listitem index ..... But why the event doesn't fire for the same listitem index when selected again.... 回答1: Because it didn't change . You can solve this by resetting the value after each change. 来源: https://stackoverflow.com/questions/2406681/why-selected-index-fires-only-once-the-index-of-the-listitem-is-changed

ListBox.SelectedIndexChanged not firing on first occasion [duplicate]

瘦欲@ 提交于 2019-12-11 06:58:22
问题 This question already has answers here : “SelectedIndexChanged” not firing after “Items.Clear()” in ListBox (4 answers) Closed 2 years ago . I have a ListBox bound to a BindingList which is empty by default. When the selected index changes it's supposed to update other controls with data from the selected object. The problem is that the SelectedIndexChanged event is not firing on the first entry (index changing from -1 to 0). It does fire however when I'm clicking on the first entry again

Difference between DropDownList.SelectedItem.Value And DropDownList.SelectedValue (ASP.NET)

江枫思渺然 提交于 2019-12-11 05:53:41
问题 I'm getting an error when SelctedIndexChanged , When the value change he gives me the previous selected value and not the new selected value. What's the problem here. And what's the difference between DropDownList.SelectedItem.Value DropDownList.SelectedValue 回答1: SelectedValues returns the Value of the selecteditem or "" if there is none. SelectedItem returns the selected item. SelectedItem.Value return the .Value of the SelectedItem. SelectedItem.Value will throw an error if there is no

SelectedIndexChange Not Firing

匆匆过客 提交于 2019-12-11 00:13:10
问题 I'm having issue with a dropdownlist updating a textbox, both held within a listview, within an update panel which in turn is in an item template. Updated I have got this working with the same code without the above containers in a different web page on the same project, however having trouble linking it with the lisview and other containers. I am unsure of where the problem lies, the onClick isn't firing unless there's a call back to the server, regardless whether the drop down is contained

DropDownList SelectedIndexChanged within Gridview not firing!

徘徊边缘 提交于 2019-12-10 15:02:15
问题 I have been looking for a solution to this for a while though and seen many posts that show me how to do it but yet I cannot get my SelectedIndexChanged event to fire when the DropDownList is changed. The DropDownList AutoPostBack is set to True, i've followed code in the below post also: Link to post Here is my code: .ASPX <asp:GridView ID="gvCases" DataKeyNames="UserId" runat="server" AutoGenerateColumns="False" BorderWidth="0px" CssClass="gridList" GridLines="None"> <AlternatingRowStyle

Recognize CheckedListBox item has been selected

吃可爱长大的小学妹 提交于 2019-12-10 14:19:40
问题 I've never dealt with checkedListBox1 until now. A program that I want to make will benefit from using it rather than having to use numerous Checkboxes. I have the code: private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e) { int selected = checkedListBox1.SelectedIndex; this.Text = checkedListBox1.Items[selected].ToString(); } The problem with this is that each time I click on the box and it highlights, it then selects the highlighted object. What I am looking for is

Dropdownlist selected value at Selectedindexchanged event

雨燕双飞 提交于 2019-12-09 16:11:32
问题 I'm working on asp.net website with Vb.net and I have a dropdownlist with autopostback = true and I need to get the selected value when I change the item or I want to get the item which fires the selectedindexchanged event .. any help please.. 回答1: In ie. your Page_Load set this.ComboBox1.SelectedIndexChanged += new System.EventHandler(ComboBox1_SelectedIndexChanged); Then write the event handler like this: private void ComboBox1_SelectedIndexChanged(object sender, System.EventArgs e) {

VB.NET: SelectedIndexChanged firing multiple times

丶灬走出姿态 提交于 2019-12-08 08:22:47
问题 I am trying to programmatically add an unspecified amount of new UserControls to a form. One will be added every time an entry is selected in a ComboBox contained within the UserControl. Problem is, the SelectedIndexChanged event fires completely erratically. Sometimes twice, sometimes 3 times, etc., but never just once. No matter how many times I set the combobox's SelectedIndex to -1, it fires at least once with a SelectedIndex of 0. Sometimes the Itemselected event fires multiple times

How do I Change comboBox.Text inside a comboBox.SelectedIndexChanged event?

拟墨画扇 提交于 2019-12-05 20:27:22
Code example: private void comboBox_SelectedIndexChanged(object sender, EventArgs e) { if(some condition) { comboBox.Text = "new string" } } My problem is that the comboBox text always shows the selected index's string value and not the new string. Is the a way round this? This code should work... public Form1() { InitializeComponent(); comboBox1.Items.AddRange(new String[] { "Item1", "Item2", "Item3" }); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { String text = "You selected: " + comboBox1.Text; BeginInvoke(new Action(() => comboBox1.Text = text)); } Hope it

Why DropDownList.SelectedIndexChanged event does not fire?

我的梦境 提交于 2019-12-05 04:04:05
问题 I have a DropDown which is bounded to an ObjectDataSource. On its data bound event, I am adding "--select--" value on the 0 index. I have a LinkButton on the page and on its client click, i am selecting different item on drop down (using JavaScript). Suppose there are 3 items like --select--, option1, option2 and option3 and now on link button's client click i selected option3, now if I select the default value "--select--", it does not fire the SelectedIndexChanged event. If I select any