Questions tagged [selectedindexchanged]

A Microsoft .NET Framework event which occurs when the SelectedIndex property has changed.

A Microsoft .NET Framework event which occurs when the SelectedIndex property has changed.

The event can be raised from ComboBox, GridView, ListControl and ListBox objects.

http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selectedindexchanged(v=vs.110).aspx
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.selectedindexchanged(v=vs.110).aspx
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.selectedindexchanged(v=vs.110).aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.selectedindexchanged(v=vs.110).aspx

305 questions
5
votes
9 answers

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

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…
McBainUK
  • 412
  • 1
  • 5
  • 15
4
votes
3 answers

Fire ListView.SelectedIndexChanged Event Programmatically?

How can one programmatically fire the SelectedIndexChanged event of a ListView? I've intended for the first item in my ListView to automatically become selected after the user completes a certain action. Code already exists within the…
James
  • 1,788
  • 4
  • 22
  • 28
4
votes
1 answer

ASP.NET combo selectedIndexChanged event is not called

I have written a selectedIndexChanged event for combo on a web page in ASP.NET (C#). This event is not called. When in debug, the control does not go into the code this event. What can be the reason?
4
votes
2 answers

Listbox.selected index change variable assignment

Hi there What is the correct way of assigning the selected index's value from a listbox to a variable? The user selects an item in a listbox and then the output changes depending on their selection. I use: variablename = listbox.text in the…
Wannabe
  • 493
  • 3
  • 10
  • 18
4
votes
5 answers

ASP.NET Dropdown List in Codebehind vs in ASPX page

I am generating a dropdown list in codebehind and cannot get the selectedindexchanged event to fire automatically. It works fine when put directly into the ASPX page, but I need it to be in the codebehind. This doesn't work: var deptList = new…
Alex
  • 136
  • 1
  • 2
  • 9
4
votes
1 answer

Listbox selectedIndexChanged doesn't fire when selecting an item from the list

I have a listbox that needs to be populated by directories. i have successfully filled the listbox with the Directories but my problem is i can't get the selected item's value. i placed a breakpoint on the SelectedIndexChanged event but my web…
danielle
  • 260
  • 2
  • 4
  • 14
4
votes
2 answers

Set ComboBox default value without directly changing SelectedIndex

I got a ComboBox with a couple of items. I want to put SelectedIndex of the ComboBox to 0, so when the user starts it, the first item is already selected (as default). However, doing this (combobox.SelectedIndex = 0;) interferes with my event…
jacobz
  • 3,191
  • 12
  • 37
  • 61
4
votes
2 answers

checkboxlist selectedindexchanged event c# not working

I've got a checkboxlist on my asp.net page. I'm populating it with countries. I've added a "SelectedIndexChanged" event that is supposed to check that if one of the selected countries is Africa, it should make a textbox visible, otherwise…
Kerieks
  • 1,042
  • 7
  • 25
  • 53
4
votes
3 answers

Alternatives to SelectedIndexChanged that don't fire on form load?

I'm developing in VB.NET with Visual Studio 2005. I have a ComboBox (myCombo) on a form that gets populated within the Load method. I also have handled myCombo.SelectedIndexChanged to change a label on the form. Edit: The way I added the event…
John
  • 15,990
  • 10
  • 70
  • 110
4
votes
2 answers

Restore a drop down selected item after postback

I'm trying to refresh page when an item of the drop down list is selected. DropDownList never gets last selected item, it always restores the one which is saved in ViewState. ViewState doesn't want to remember new stuff, it always keeps one and the…
user2182397
4
votes
4 answers

ComboBox got new SelectedValue on SelectionChangeCommitted but doesn't got new SelectedText

I have this code private void FrmNovedadMedidas_SelectionChangeCommitted(object sender, EventArgs e) { ComboBox c = (ComboBox)sender; CargarMedidasPorIdTipoMedida(Convert.ToInt16(c.SelectedValue)); …
Gonzalo.-
  • 12,512
  • 5
  • 50
  • 82
4
votes
2 answers

ASP.NET / C#: DropDownList SelectedIndexChanged event not firing

My selectedindexchanged event is not firing when I select values in my dropdown lists. These dropdown lists are implemented dynamically in the following code. I have tried changing autopostback and enableviewstate settings to no avail. I am using…
salvationishere
  • 3,461
  • 29
  • 104
  • 143
3
votes
2 answers

How can I refresh a dropdownlist during an event of another dropdownlist without refreshing whole web page?

I am developing my first asp.net website, my requirement is to refresh DropDownListB at SelectedIndexChanged event of DropDownListA, I have set AutoPostBack="True" for DropDownListA. Now the problem is whole web page gets refreshed, its…
3
votes
2 answers

Viewstate issue with first dropdownlist item selection

In my ASP.NET 4.0 website, which uses master pages, I've disabled viewstate sitewide in web.config: and am trying to enable it only when absolutely necessary. I've run into an issue with a DropDownList control (no…
Adam Kane
  • 3,996
  • 7
  • 44
  • 53
3
votes
1 answer

MouseDown in WinForm ListBox Kills SelectedIndexChanged

I'm writing some code to detect toggling of selections in a WindForms ListBox with MultiSelect turned on. Since SelectedIndexChanged only lets me see what is selected after the click, I was looking for a way to detect what was selected before the…
Mike Malter
  • 1,018
  • 1
  • 14
  • 38
1
2
3
20 21