Hi Manolo,
Sorry for the inconvenient.
Since the reported requirement as a defect, we have created an incident in your account. Kindly follow up the incident for further queries.
Please let me know if any concerns.
Regards,
Kalai Selvi
private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e) { // Get the currently selected item in the ListBox. string curItem = listBox1.SelectedItem.ToString(); // Find the string in ListBox2. int index = listBox2.FindString(curItem); // If the item was not found in ListBox 2 display a message box, otherwise select it in ListBox2. if(index == -1) MessageBox.Show("Item is not available in ListBox2"); else listBox2.SetSelected(index,true); }
Helpful resource :-https://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.selecteditem%28v=vs.110%29.aspx
Thanks!!
protected void butn_Click(object Sender, Syncfusion.JavaScript.Web.ButtonEventArgs e) { //to assign the selected items in the listbox controls int selectItemIndex = ListBox1.SelectedItemIndex; Item selectedItem;; if (selectItemIndex == -1) selectedItem = null; else selectedItem = GetItems().ElementAt(selectItemIndex); // to get the element based on our selected index //get the text from the selected element if its not means return the message var selectedText = selectedItem!=null? selectedItem.Name:"Item is not available in ListBox2"; |