obout combobox setValue() - asp.net

I am using an obout combobox to display color swatches for a product catalog and it's very cool except for one thing.
When on the server, I set the .Value property explicity (for a reset) it IS setting on the serverside, but not in the client.
For example, I add all my color swatches from Linq, but then add a default setting of "Color..." with a value of "". But on first display the combobox shows as empty (the text part). When I click the down arrow, then everything is correct.
I've tried setting the index, the value, the text and none work.
I have also added a registerclientscript to try and force this on the client side and while the script is running (test with an alert), the box is not getting set.
Any ideas?

Apparently you cannot set a value to "", you must set it to " ". Then it will work. :)

Related

Binding column text property to another property with refresh (JavaFX)

Could somebody tell me how shold I approach binding the text property of a column header in a TableView to another property, that can be changed with a combobox selection?
I tried column.textProperty().bind(myProperty) , but the column header doesn't refresh the text when myProperty changes. It only happens after I click on the column header as if I wanted to sort the column. Is there any way to make it refresh automatically when changed ? Or does anybody have other suggestions how to approach this ?
Found out it was because I've accidentally put the method that changes the property into a block that runs in a separate thread.

LiveCycle Highlighting when Changed from Default

I have a large form that has already been made, there are many different objects in the form including drop downs and check boxes. The majority of the objects are check boxes. I need the boxes to turn red if they are changed from the default. Some defaults are "on" others are "off" I can do this item by item, but it's very time consuming. Is there a way to make it a standard for the form?
The other issue I am having is, if they change it from the default it turns red, however if it is returned to the default it stays red, is there a way to make it change back? I feel like this should be something simple that I am just missing.
You can use scripting on enter and exit events
In Adobe LiveCycle Designer select all the fields you want to change the highlighting and add the following scripts to each text field:
Add an enter event to the fields to highlight in red:
field1.border.edge.color.value = "255,0,0";
field2.border.edge.color.value = "255,0,0";
Add an exit event to the fields to highlight in black:
field1.border.edge.color.value = "255,255,255";
field2.border.edge.color.value = "255,255,255";

Custom TextInput component loses focus but still contains cursor?

I have a custom TextInput that listens for the FocusEvent.FOCUS_IN and FocusEvent.FOCUS_OUT events:
textDisplay.addEventListener(FocusEvent.FOCUS_IN, onFocusInHandler);
textDisplay.addEventListener(FocusEvent.FOCUS_OUT, onFocusOutHandler);
My onFocusInHandler function basically removes a "promptview" that tells the user to type in a value, with the onFocusOutHandler doing the opposite.
For example, if the TextInput text was backspaced to a blank value and the user clicks out of the TextInput box, it would show a "Please enter a value" light-gray prompt in the TextInput.
This works fine until the user clicks our custom "Clear" button. The clear button sets the text to "", and I can tell the FocusEvent.FOCUS_OUT is received because the prompt text is set to visible (its not being set anywhere else). The problem is, the cursor remains in the box as if it still has focus, so if the user immediately starts typing, both the prompt text "Please enter a value" and the user-entered text appears over the gray text, which looks pretty ugly and unreadable.
Why does the TextInput receive the FocusEvent.FOCUS_OUT event if it's not actually losing focus? Is there any way I can get around this?
Option 1. Use the Spak TextInput in Flex 4.1 or 4.5. This already provides a promptDisplay by default (as mentioned in the comments)
Option 2. Take a look at the focus-skin. This skin class is usually placed on top of the normal skin. There could exist some focus ambiguity between these two. Try using a custom focus-skin without a textDisplay and clear button.
Option 3. Not only use a focus event to show or hide the prompt, but also look at the content of the TextInput. You don't want to display a prompt when the text is set by binding as wel.

How to populate long text in dropdownlist in asp.net

In asp.net, am trying to populate a dropdownlist box with very long text. I have fixed the width of list on the page and i don't want to change its size as it would affect my page layout. On clicking the dropdownlist, the text gets truncated to the size of the dropdown. I want to see the entire text without any truncation, without changing the size of the dropdownlist box..Also if there are any third party controls which would solve this problem?Would be very helpful if there's a solution for this.
Update:
Right now am trying a dropdown box in Jquery that will wrap the text if it exceeds the size..but again the problem is it works fine on an independent solution but when i integrate it with my application, it does not read the .css file and it does not do any formatting(style, font, alignment) that it is supposed to do according to the .css file.Any idea why this is happening?
The problem that you're describing is restricted to IE (it might be fixed in the latest version, I haven't tested).
In the past, I've had success with binding javascript methods to the onClick event on the drop down to increase the width, and the onBlur event to set the width back to its original value.
You might be able to use jQuery to create a tooltip like thing that appears when you hover over each option.
something like
// this executes on page load - just like asp.net Page_load()
function pageLoad(){
// attach a mouseover event to each option in your dropdown
$("#myDropdown option").mouseover(function(){
// get the text from that option
var text = $("#"+this.id).text();
// display that text in a small tooltip
showToolTip(text);
});
}
function showToolTip(text){
// display in some way
}
there's a javascript library called wz_tooltip available at walterzorn.com
hope that helps

Is it possible to catch a comboBoxes value before change with a change event

I am displaying a combo box in something of a WYSIWYG preview. I want the user to be able to click on the combo box and see the options inside, but I don't want them to be able to change the value. I tried using preventDefault() on the change event but it doesn't work. I don't want to disable it because I do want the user to be able to "look inside" the dropdown.
So I'm trying to block the change, but can't. My next resort is to change the selected index back to what it was before the change, Is there any way to do this within the scope of a ListEvent.CHANGE event listener?
Current Workaround is to basically re-assign the controls selected item the same way I am defining the selected item when I originally build it (a default selection). So a user sees their change then it immediately changes back to the default selection.
Are you sure that a combobox is what you want? could you do the same thing with a list component that is not selectable?
update:
If you must use a combobox and you dont want the lag from listening for the event and resetting the control, I see two possible options. You could subclass the control and make your own. When you do, hijack any methods that set the value besides the initial selection.
Or, you could try something like this: http://wmcai.blog.163.com/blog/static/4802420088945053961/. The site seems like it is in another language but the code is still there. It will allow you to make your options disabled, so the user cannot choose one of the other options.
HTH

Resources