I try to use this example http://www.codeproject.com/KB/combobox/CheckComboBox.aspx to create multicheck combobox. Everything is all right, but when user select item in dropdown list it close and need another time click on it and select next item.
It is possible that when I fires onClick and dropdown show i t don't hide unless mouse lost focus on combobox ?
In the comments on the page you linked to, someone posted previously (August 2007) this exact question - and someone else responded with this alternative implementation as the solution: http://www.codeproject.com/KB/combobox/checkedcombobox.aspx
Related
hope you are well!
Youtube video of my problem
As you can see in the short video (49 seconds), when I change a value in the datagrid and click the update button the datagrid.CurrentItem doesn't have the changed value but when I update it for the second time and I first click outside the datagrid row and then click the update button it works... I have tried an observable collection (a colleague suggested, but I have never worked with them before and as far as I can see it made no difference. The collection didn't even update.)
Thanks for taking the time to help!
Classic "edit mode" problem. In the first take, the cell is in "edit mode", and has not yet committed the value to the row. In the second take, you click off, allowing the cell's editor to validate and commit. That's the only difference.
So, if you want to be able to support the first behavior, you need to add a line to the button click handler to validate the row.
Something like this, perhaps:
rowBeingEdited.EndEdit();
I don't think an ObservableCollection would solve anything, because it is not a data store problem, it is a problem with the editor not realizing that you are done with the edit.
I'm trying to create a simple data application for a school project, in which an user selects data from an databound combobox for and fills out several textboxes for it to be committed to the database. However, when after I databind the combobox, and select an item, it simply will not let the user select something else. It's impossible to let edit anything, since the focus doesn't go away from the combobox.
What is happening?
Nevermind, found the solution. All I had to do was to set the ComboBox's CausesValidation to false.
I am trying to look for a simple way to design a winform with a combobox that has checkbox values in it to select multiple values.
But there are no free samples I could find.
If anybody has a good link for a sample which does not require a license.
Please let me know.
I am not looking for controls like telerik and infragistics.
Maybe this example can help you.
CheckBox ComboBox Extending the ComboBox Class and Its Items
It sounds like what you really want is a checked listbox control or maybe even just a listbox. These controls do multi-select in a way that is more standard for Windows.
If you really need a combo box with checkboxes in it, here's an article on code project I used once.
My suggestion, if space is an issue as #rmc00 has eluded to, place a button at the end of a readonly Textbox with perhaps an elipse (...) or down arrow (same as combobox) as the text of the button and when clicked or MouseDown make visible and position a CheckBoxList or open a popup dialog with a CheckBoxList this way you can either prepopulate at design time or pass a DataTable as a parameter/property to your control/form so it is databound at runtime. You can always place your control or write code to position the control/form exactly below your TextBox in the MouseDown/Click event. On check change update your textbox with a comma separated list (or go fancy and say if more than 3 items the text box can have the list stored in the Tag and the TextBox Text can have the count of items checked). Finally on LostFocus hide the Control (or Form), and further if you want to get fancy make the exception to not hide when the ActiveControl is the Button that way you can toggle the visibility of consecutive button presses.
Hello everybody !
In .net , i have a Devexpress control [aspxgridview ]... in edit mode of this control , i fill a repeater that has ItemDataBound event
when i press on update btn (of grid) , itemdatabound calls & works very well & i choose an item (is a radioBtn)
BUT
when i press updateBtn , that event i said (itemdatabound) fires again &
my selected item CLEAR (i'm crying)
please help me dears!!
thanks in advance
mohammad
Since your button is doing a postback, you need to have all items on your page re-created and re-databound in order for them to be displayed. Without having much to go on, it sounds like you need to hold onto your selected item so you can re-create/re-databind the Repeater with every post back.
I may be able to be of more help if you post your code.
I have a formview with an insertion template. In this template there is a drop down list with a number of items I want users to be able to select from. Beside the drop down list there is a button which I am using to add the selected item from the drop down list to a gridview which also exists in the insertion template.
My problem is that when I click the button to add the selected item from the drop down list the selected item, index or value from the drop down list are not available. I am using a OnClick event handler to catch the event from the button click but I suspect there is some kind of refresh of the template going on here which I am not understanding as nothing appears to be accessible from the button event handler. I don't believe a postback is occurring as I have disabled the CausesValidation property for my button.
It seems like you are binding your DDL on postbacks as well. If the ddl data isnt hardcoded and you have the call for your ddl databind function in the Page_Load, you need to call the function like this to ensure it is not bound on postback:
if(!IsPostBack)
{
BindDDL();
}
Otherwise we need more information to help you and please post your code.
If you are clicking an asp:Button with an OnClick eevent attached to it then you are posting back to the server, no matter whether or not CausesValidation is true or not.
Are you binding data to the DropDownList? If so and you are rebinding it on postback then you'll not have the selected item you're expecting.
Can you paste us the code here?
I would have to see the code, but it sounds like you are getting a rebind prior to pulling the chosen items. One way to examine this is to add a watcha nd then make sure you code in the various ASP.NET events and then watch.
Without seeing what you are doing in code, I cannot tell if this is a drag and drop anomoly or something you have coded in. But the symptoms you are describing fits the typcial bind in Page_Load scenario, which is what jmein was aiming at.
So it turns it out it was all my fault. The formview control I have is contained in a panel which did not have view state enabled. This was preventing the drop down list from remembering the item I had selected it seems.
Thanks all for your comments and suggestions.