I have few Ext.NET ComboBox controls on a Web Form. Selecting an item from the first fires the ValueChanged event to populate the second, and so on.
Except Force Selection property, I have not altered other properties of the ComboBox control.
I am experiencing odd behavior of Combo Box controls. As all controls get filled via AJAX request, I find it difficult to set focus on any control. As soon as I bring focus on any control, the cursor disappears after it gets filled.
Secondly, one of the ComboBox is not permitting me to select an item from the list. Even if I try to select an item, it automatically brings back the default item back, which is actually a sixth item in the list.
I double checked the queries and there is no way through which sixth item should get selected.
If I try to open the DropDown list using mouse, it opens for few seconds and collapses automatically.
Is there any way to fix these strange issue? Any other third-party open-source control?
I guess that combos are rebinded in each ajax requests
I suggest to rebind combos in Select direct event handler
Also see the following sample
http://examples1.ext.net/#/Form/ComboBox/Ajax_Linked_Combos/
Related
I am trying (and failing) to get a very simple webpart working.
button which when pressed adds list item into custom list (this works great)
list out all the items from the custom list (this also works great)
the problem is that when i display the items and add a new item i need to refresh twice to get the listing to display the item that i am trying to display. What is the correct lifecycle that i need to follow with createchildcontrols, onload etc so that when i click the button and it adds a record in that the listing will display the newly inserted item.
Thanks
This is probably a case of setting the control values or forcing databinding in OnLoad; this is before the "add item" occurs which is before the new item has been added.
I recommend using Data-Binding expressions and ensuring databinding in PreRender1. As long all the controls follow this later-databinding it should Just Work. Otherwise, manually force update/databind the appropriate controls after (or in response to) the "add item" action.
The Life Cycle is the same as for ASP.NET WebForms, and summarized for the issue:
- "OnLoad"
- PostBack Actions such as "OnClick"
- "PreRender"
1 Databinding in PreRender works - even though it initially seems like it ought not to - because ASP.Net controls will Catch-Up as required.
I have a page that if IsPostBack is true, calls a javascript function which gets the size of the screen, passes the width and height to hidden fields and clicks a button to cause a PostBack. So I can retrieve the size of the user's screen and then load the page with default data with tables the right size etc.
Invariably, when the page (having posted back once) displays the data, a gridview is populated. Each row has a 'delete' Link Button in it. Each Link Button is set OnClientClick to call a javascript function to confirm you want to delete.
Above the grid is a row of text boxes / buttons / dropdownlists which allow you to search for, or filter the data showing. The Gridview is in an update panel. When the page first loads its data, and shows the list of projects, the delete Link Buttons all work okay. In every row, no problem. The Confirm box is displayed and, if Okay is selected, the asynchronous postback occurs.
If, after the initial data is displayed (which is already after one postback) you then use the search box and button, or use a dropdownlist to filter the data (the Search button and filter DropDownList are async triggers for the UpdatePanel) the data refreshes okay (always) but, then, sometimes, the 'delete' LinkButton in each row of the GridView does nothing. It doesn't even fire the ClientSide function. It's as if it is dead.
I had a similar problem a while ago with ImageButtons and the received wisdom seems to be 'change them to LinkButtons'. But I have dozens of grids with 'delete' LinkButtons that work okay, but this one has decided to stop working - sometimes.
I have to say, since moving to Framework 4.0, I'm thinking of giving up on UpdatePanels. Seem to have nothing but problems with sites that worked reliably for years in Framework 2.0
Any ideas please? Is this anything to do with the order in which controls are loaded on the second postbacks?
Edit: There is a twist to this. When this situation occurs, i.e. clicking on the Delete link does not even trigger the Client Side event - if you click on an area of the page outside the Gridview (i.e. outside the UpdatePanel) - and then click back on the Delete link - it works!
Regarding ImageButtons: There is a bug with IE10: ASP.NET fails to detect IE10 causing _doPostBack is undefined JavaScript error or maintain FF5 scrollbar position ( http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx ). Just upgrade to .NET 4.5.
Regarding LinkButtons: Do you have "ID" property? I remember I had a similar issue because my linkButton didn't have an ID.
Could you post some code? It would help.
I am using Ext.Net 1.3 library for ASP.NET.
I have five ComboBox controls and each is linked to the other. Selection in the first ComboBox is compulsory. Selecting an item from the first fills the second ComboBox, and so on.
The problem is when I press TAB key to navigate on the controls, the focus is lost after appearing for some time on the next Combo.
This is because, when the first Combo looses focus, it fires the OnSelectedValueChanged event which executes the code to fill the second ComboBox using AJAX.
How to keep the focus intact even while AJAX request is executed?
One option may be to call .Focus() on the triggering ComboBox from within your OnSelectedValueChanged event handler.
This will force the focus to be reset on the ComboBox after the DirectEvent returns.
Hope this helps.
I have a listbox which acts as a list of items. If you click on some item, it's contents are shown in the panel on the right (few textboxes etc.).
I need to have a validation on these controls as all of them are required fields. And I do have it. The problem is that, even when the validators are not valid, user can click the listbox and change active index (that doesn't have impact on the panel on the right, as SelectedIndexChanged isn't fired).
The validators are standard RequiredFieldValidator with their Display property set to "Dynamic". So, what I want is to disallow the user clicking on the listbox and changing the index untill all validators are Valid.
What would be your solution for that? Is that even possible?
Did you try setting ListBox.Enabled = false when you actually do fire off the SelectedIndexChanged, and reenabling when your required fields meet the Page.IsValid requirement to proceed in code execution?
I have the most bizarre bug, where clicking a listbox item makes the listbox scroll down so that item is at the top. It's very annoying.
The listbox is in an updatepanel, so my best guess is when it posts back, asp.net remembers the selected index, populates the listbox, and then sets the selected index, causing it to scroll up until the selected index is on the screen.
Is there any way to stop it doing this? Perhaps it can remember how far down the scrollbar was...
Are you binding the contents of the listbox to a data source? If so, you may be rebinding it every time it posts back.
My fault, it was triggering an updatepanel which in turn refreshed the original update panel, causing the contents to redraw and thus resetting the position of the listbox.