RadGrid Filter is showing error - asp.net

In RadGrid filter , i am using
CurrentFilterFunction="Contains",AutoPostBackOnFilter="true"
Every thing is fine , But one issue I've noticed is that if the user types in the the filter text box and then clicks on the menu to select another option, the default filter is immediately applied, and what i have chosen option from menu that is not opening.
And also i don't want use "FilterDelay" because it is filtering automatically after time interval.
Here i want, When Press on Enter or Tab Buttons filter should work and when user type some text in filter textbox next click on any option from menu that will open.
Can any one give solution?
Thanks..

Well, basically with RadGrid and filtering you can't have it both ways. If you define both CurrentFilterFunction and set AutoPostBackOnFilter to true. You can't expect the filtering menu to work the way you want to. That is because AutoPostBackOnFilter will rebind the grid when the filter textbox loses focus (if the value has changed), so if you change the value of the filter textbox and then you want to select a different filter function(using the filtering menu) the grid will refresh before you get to select an item from the filtering menu. What you can do is...
Keep the CurrentFilterFunction, set the AutoPostBackOnFilter to true and then set ShowFilterIcon to false so that users can NOT select a different filtering function, or...
Keep the CurrentFilterFunction, set the AutoPostBackOnFilter to false and then set ShowFilterIcon to true so that users are able to select a different filtering function but notice that you will be dropping a functionality here as well...users will have to MANUALLY select a filtering function in order to filter the grid rather than pressing ENTER
As mentioned, you can't enable both AutoPostBackOnFilter and the filter icon at the same time otherwise you will get exactly these unexpected results

Related

Remove Style from table in Code Behind

This should be a lot easier than it appears to be, but I'm having an issue with it.
Conditions
If upon entering this specific page, if there is only one record in the grid (based on a status value in a dropdown), hide the grid and show a table with the details of that record.
If there is more than one record, display the grid with the records.
When a record is selected, display the table with the details of that record.
When I go into the page currently, there is only one record, so it is displaying the table. If I change the value of the dropdown to another status, more than one record is in the grid and the table is hidden. Previously (by another programmer) it was being set to Visible = false. Obviously, this is not a property of the table. However, it previously worked as when someone would select a row, they would set the Visible = true and the table would show.
I've now changed it to hide by using:
tblDetails.Attributes("style") = "display:none"
However, trying to replace the Visible = true is not working:
tblDetails.Attributes.Remove("style")
I have also tried:
tblDetails.Attributes("style") = ""
Someone please point out to me the solution that is going to make me slap my forehead. Thanks.
use setAttribute(attr,value) to change the value of each Element You want
like below example
yourelement.setAttribute("style","");//it is to change value
yourelement.removeAttribute("style")//it is used to remove style attrb from your element

List Component that acts as if control was permanently pressed

I have a list control and i want the user to be able to select many items at a time. Thus I want it to act that if the control key is pressed while he is clicking. Eg if he clicks on a selected row it should become unselected and if he clicks on a unselected row it should become selected.
Do you have any idea how to do this?
Thanks,
Dennis
If you want to follow standard UI Precedent; then set allowMultipleSelection to true and teach your users to use the control and/or shift button to select multiple items.
If you want to select multiple items without having the using press the shift or control button you'll have to extend the List class. I did a sample a while ago using the DataGrid:
http://www.flextras.com/blog/index.cfm/2009/7/23/Flextras-Friday-Lunch--Episode-22--07032009--Auto-Select-DataGrid
http://www.flextras.com/labs/AutoSelectDataGrid/
http://www.flextras.com/labs/AutoSelectDataGrid/srcview/index.html
You can probably use the same technique with a List. But, I don't recommend this approach.

Display old inactive data in dropdown

I have a dropdown which displays some programs (active and inactive). I have a column (isActive) in the programs table in the database which either has a value N or Y.
Now I want to filter the dropdown to display only active programs. So, I will just do a sql select to get all programs which are active. Everything is fine up to here.
Now if a user tries to access his record and the program which this user selected (sometime earlier) is no longer active now, the dropdown will now show the first value.
What is a possible solution for this issue? How can I only show active programs in the dropdown without messing up with users record?
Make your first option in the select be a blank value. That way it will default blank if no value is present in the dropdown to select. Then, just validate your form so you don't get a blank value.

ASP.Net Cannot tab through all radio buttons when selected

I'm trying to implement accessibility (keyboard only) ability on my site, but I'm having problems with Radio Button lists. When using radiobuttonlists, when initially, none of the radio buttons is selected, I am able to tab through every single value and select one upon hitting "enter". However, after a value is selected, I can only tab to the selected values, which presents a problem if I want to change the selected value.
From what I understand, radio buttons are grouped at the container controller level, thus when it is considered a group, only one can be selected at a time.
Any ideas on how to fix this issue?
Actually, this is not an issue at all. If a value is not selected, the browser will go through each value within the group. Once a value is selected, the browser will only jump to the chosen value within that group. Thus to change values within the group, the user is to use the keyboard arrows.
I believe you're correct about the RadioButtonList being one control (and therefore tabbing doesn't work). An alternative could be to create individual radio buttons and use the GroupName property to assign them all into one group. This should let you tab between them and still ensure they work in sync with each other.

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