I have two listboxes, Listbox1 and Listbox2. When I select few values from Listbox1 to Listbox2 and hit save the first item on the listbox2 gets recorded into the database but I can see still see all the all the items on Listbox2 when I hit edit from saved list in webpage. Now when I want to clear listbox2 in edit mode i.e. move all the selected items in Listbox2 to list box 1 and hit save, database gets cleared, no values are saved but my Listbox2 donot clear those items. Any suggestions?
You can use Linq to set all the ListItems selections to false.
ListBox1.Items.Cast<ListItem>().ToList().ForEach(x => x.Selected = false);
Related
When I insert a new match after removing one from the collection view.
It remembers the last match's state.
here if I have selected Chelsea previously it will kept the 2nd option selected for the new entry
So I have CollectionItemView custom control defined and used in the collection view item template and the collection view is binded with an observable collection from which I remove the item upon removing item CollectionItemView disappears but when I insert new item in the observable collection the state of previously removed CollectionItemView restore itself.
Bind itemsource to an observablecollection and remove from/add to that. Any changes will impact the UI.
I have a list of items. First I select an item from list then save it in local db. Now I want that when user open app next time. The save item should be default selected in the list. But no item is selecting default when user comes next time.
How is it possible in xamarin.forms to select an item default selected in listview?
You can set the Listview Selected Item in your code behind.
Assuming you have Binded your ItemsSource, you just need to get the object you want to set as selected and do this:
ListviewItems.SelectedItem = YourCollection[YourIndex];
I have a question about a suspicious behaviour in Forms Builder 10.1.2.0.2.
When I have a list object (pop up list) I can define some values in the attribute palette of the object.
So you can set a shown name and a value behind. In this little window to set the items of the popup list you get automatically a white empty item at the end of the list. When I click now on this empty item (you do so, when you want to add an item) Forms Builder automatically adds an new empty item at the end.
When I click this new empty item, Forms Builder adss another empty one ... and so on.
It´s very suspicious because, when I end this dialog with "OK", it will be saved and when I open the form (over web) I have at the end of the list one, two (or more) empty elements in list.
But I can´t delete this empty ones from the list in Forms Builder.
So my question:
how can I delete empty items in a popup list??
I try it with hit "del" button at keyboard or delete the set value for the item (I hope Forms Builder delete items without value). But all does not help.
ctrl+shift+<
or
On my german keyboard it is:
ctrl+< for deleting a line
ctrl+> (= ctrl+shift+<) for adding a new line
When adding the list elements and list values, make sure you only add the ones you need, if you need 3 elements in your list don't click on the 4th box in the property palette, this will add one more list element.
If you have a blank element and you want to remove it, the only way is to click on the property without clicking the "More..." button press on the "Inherit" button on the top of the property palette, this will reset the list elements and list values so you can add only the elements you want.
if you still have extra empty option then make sure of these:
1- make pop list item required
2- if its database item ... make sure you have yes on databse item and column name filled
3- make the column in table to have default value like '1'
hey perhaps you should try this ctrl+shift+,
I have an ASP .net grid view. It has some template columns like a command button, a text box, and a dropdown control. When I click the command button, a new row needs to be inserted below the current row (from where I hit the command button).
If I have rows 1 and 2 and I hit the command button in row1 a new row needs to be inserted between rows 1 and 2
Now in the new row I should be able to select values from dropdown and enter some value in a text box and finally hit my save button. (Which should work fine as I am expecting)
The grid view is bound to some data source say for instance a datatable for now.
Oneway that I could think about is when Command button is clicked, I can add a new row to the datatable in my server side code and rebind the grid. But I am not sure that, from a UI perspective how I can make sure that the new row goes exactly below the row from where I hit the command button.
Any thoughts or comments?
I think a much easier approach will be if you try to add the row in your data source and then bind to the GridView again. This is easy if you have DataSet or a custom entity collection. Since, you are using DataTable this will also work. Handle the click event and find the row that the user clicked. Go back to the dataTable and add an empty row there. This will make sure that the controls inside the GridView are persisted and you don't have to worry about adding DropDown controls etc.
You have to sort the datasource by an virtual index saved in an invisible column. On first databound(perhaps you take a DataView because of ots sorting capability) it will set to the original rowindex. After first hit of the save button you get the datatable again from database and add the additional row with an index after the "selected" row. Then you bind the GridView again with the sorted DataView.
I think you need another invisible column to detect the "temporary" row. If you dont need to edit the "normal" rows then you can use edititemtemplate for this. Otherwise you can make the dropdown and textbox visible and the other controls invisible in GridView.OnRoawDataBound.
There is a code sample that is used for adding a new row in between rows in a grid view.
I have a flex datagrid in a popupwindow.That datagrid should be empty means there is no dataprovider.User will provide data.For that purpose I have to make datagrid columns editable.I tried with editable property.It is not working.And also one more requirment is whenever user completed entering of first row data,next row has to be displayed with empty cells.Can anyone help me.
The datagrid should be displayed with editable empty fields.
You need to set a dataprovider for the datagrid. You need an ArrayCollection that holds all the (newly added) entries from the user plus an empty entry. When you initialize the dataprovider it has to contain the empty entry, otherwise there will not be the possibility to "add" a new entry via the grid because the grid only allows to edit the existing entries. So after the user begins to fill the empty entry, you have to add a new, empty entry to the dataprovider.