.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Custom listbox filter

Posted By:      Posted Date: September 06, 2010    Points: 0   Category :ASP.Net
Hi, I'm trying to create a multiselect listbox filter control.  I was using Josh Heyes filters but I'm upgrading to 4.0 and this is no longer compatible.  I have created a new UserControl which inherits from QueryableFilterUserControl, but I can't work out what I need to put into the GetQueryable method.  It's very similar to the ForeignKey filter, it's just that I want the user to be able to select multiple items in the list. Can anyone help? Thanks, Emma

View Complete Post

More Related Resource Links

Filter a listbox with textbox


So i currently filter the listbox with some javascript i have found.
What it does is going to the item i type on the textbox.
It will not filter the listbox so it will contain the specific matches.
I was reading for autocomplete but i don't seem to find this 2 way usage.
I was also reading this article:
But i'm completely lost on how i can implement it.
Any ideas?

Custom Alert Filter Definition

I was trying to create custom filter definition. Requirement : Send alert when the body of discussion contains certain words. These words are to be configurable. I just followed the steps in this blog. http://blogs.msdn.com/b/sharepointdeveloperdocs/archive/2007/12/07/customizing-alert-notifications-and-alert-templates-in-windows-sharepoint-services-3-0.aspx Created seperate template xml and added the definition like below <Filters> <FilterDefinition> <FriendlyName>Post contains </FriendlyName> <ShortName>words or phrase </ShortName> <Query> <Where> <Contains> <FieldRef Name="Body" /> <Value Type="Note">hi</Value> </Contains> </Where> </Query> </FilterDefinition> </Filters> I'm getting some blank radio buttons in the alert configure page, not sure whether to add the custom entries to resource file, where to make changes in core resource file? The value I'm trying to search is hardcoded now in the CAML, I want some text box for entering the value. Please advise.

Custom OR Filter on XsltListViewWebPart

Hi, I am having some issues getting a custom document library that is being viewed in an xsltListViewWebPart to filter the way I want it to.   I have found 2 ways to filter down the list using user input. 1.) Add values to the FilterOperations collection based on user input. This works great when you are only trying to filter on one column, or narrowing down searches based on columns. My issue with this method is that I can't search for values in multiple columns (Can do Column1 and Column2 but NOT column1 or column2) 2.) Modify the xmlDefinition of the xsltlistviewwebpart and inject my own query into the xml. This works greats on actually filtering, I can filter down on whatever I want, however, when I do this, I lose ribbon functionality on all but the items that originally appeared on the first page. If you searched for something that returned the 1st and 1530th files in the list, you could use the ribbon on the 1st item, but all document specific ribbon controls are disabled for the 1530th file. There are thousands of documents in this library and the only reason you would search for it is because you want to edit the properties or something, so this is kind of a big deal.   What I am looking for is the best way to filter down the document library dynamically using OR statements and user input.   Any help would be greatly appreciated.

Custom ListBox Help Needed

Hi,   We have a DataTemplate that includes a ListBox. Each ListBoxItem has some additional functionality provided by a 3rd party diagram component we are using. I need the functionality of the ListBox (selection, key-presses etc) but having this functionality seems to prevent the 3rd party stuff from working. The manufacturer of the 3rd party component suggested creating a custom ListBox with the code below.   public class CustomListBox : ListBox { protected override DependencyObject GetContainerForItemOverride() { return new CustomListBoxItem(); } } public class CustomListBoxItem : ListBoxItem { protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); e.Handled = false; } } This is great for making the 3rd party stuff work again but now we have lost the ListBox functionality (selection, key-presses). Setting e.Handled=true, obviously makes it work as the normal ListBox.   Any help is greatly appreciated.   Neil.      

How to get values setted in custom items from a ListBox




I have a ListBox which looks like that :

Its DataTemplat is :


<DataTemplate x:Key="IndexDataTemplate">
   <StackPanel Margin="0,0,0,5">
    <TextBlock Height="Auto"

Custom List View - filter blank value



I am creating a custom list view in SPD2010 and am having some problems. I want to have 3 filters (language, country and quarter). I have set these up as ASP drop down lists that auto postback and then I have defined the paramaters and linked them into the list filter.




This works fine and all 3 drop downs filter the list. The only problem I am having is if I want to search just on one column. The way I have it set up in the filter is

Country EQUALS [Country] AND
Language EQUALS [Language] AND
Quarter EQUALS [Quarter]

If I want to show all entries from Germany and not filter on Language and Quarter how do I do this? I have tried adding a "Please Select.." entry at the top of the list and setting the value to nothing but it does not work. I have had to create 3 seperate views but I would love to get these 3 filters working at the same time.

Is there a value in SP that I can use to filter on blank values or not consider the column at all? I have tried using nothing in the value and also tried NULL but neither have worked.

I have been trying to solve this for some time with no luck :( If anyone has any

How do i display a custom message when my ListBox is empty?


I've got a ListBox. Its ItemsSource is Data-Bound to a Dataset.

When there are entries in the Dataset, the ListBox displays them, and it doesn't look so bad.

The ListBox is big, so when its empty it looks weird on the Window.

What i want to do is to display a custom mesasge somewhere inside the listbox(maybe in the center) if there is nothing to display. But i've had no luck sofar.

How could i go about achieving this?

Best Practice for connect SSRS Report Viewer Web part with custom filter web part (With Dropdown\Lis


To make a filter provider web part, I implemented the interface ITransformableFilterValues.
Implemented the various properties of the ITransformableFilterValues interface
and method that creates an instance of our filter provider.

[aspnetwebparts.ConnectionProvider("AccountFilter", "ITransformableFilterValues", AllowsMultipleConnections = true)]
public ITransformableFilterValues SetConnectionInterface()
return this;

Is this a best practice .Please share your suggestion.


Best Practice for connect SSRS Report Viewer Web part with custom filter web part (With Dropdown\Lis


To make a filter provider web part, I implemented the interface ITransformableFilterValues.
Implemented the various properties of the ITransformableFilterValues interface
and method that creates an instance of our filter provider.

[aspnetwebparts.ConnectionProvider("AccountFilter", "ITransformableFilterValues", AllowsMultipleConnections = true)]
public ITransformableFilterValues SetConnectionInterface()
return this;

Is this a best practice .Please share your suggestion.


How to pass multiple filter parameters to moss report viewer from custom filter provider


I have written a custom filter provider webpart which implements ITransformableFilterValues to pass parameter value to moss report viewer webpart.

However, this interface only allows to pass one parameter. Please can someone guide me through correct resource which allows my custom filter provider webpart to pass multiple parameters to report viewer. E.g if my report has 5 parameters then my filter provider webpart should allow me to make connection with report viewer and pass all 5 parameters.

Custom ListBox Hot Tracking


I have created a custom ListBox control which mimics something similar to the options window in MS Office 2007 with the hot-tracking functionality.

I have overridden the OnDrawItem method to do all my custom painting, however when I attempt to handle the DrawItemState.HotLight nothing happens. It appears that this state is invalid and that hot tracking is not used by a ListBox control.

Can anyone confirm or deny this? Does anyone know of a valid workaround?

Thanks in advance,


How to create a filter for my custom webpart toolpart


Hi All,

I have to create a filter for my custom webpart toolpart, similar to the filters in Content Query webpart toolpart.
What is the best way to get this achieved?


Custom filter - Looking in 2 fields


I'm using DD and VS 2010 in my application.

I have two dates (Start Time and PLN Start Time). In my filter, when the user choose a date, if the Start Time is null, I need to verify the PLN Start Time. Something like the code bellow:


        public DateTime StartTimeFilter
                if (this.StartTime.HasValue)
                    return Convert.ToDateTime(this.StartTime);
                    return Convert.ToDateTime(this.PLNStartTime);

How I can insert that column in my page filter ?

Custom Multi Filter Web Part for Report Viewer

I want to create a custom web part that has more than 1 filter web part and that can be connected to Report Viewer Web Part (Integrated Mode) at runt time/design time.

I searched a lot but could not find a way to have single web part that is a provider to more than 1 filters.
Say for example -
  1. My Report accept 2 parameter Department and Region. 
  2. I want to connect both parameter with single web part having two drop down (one for Department and one for Region)
  3. Values from both the drop down should be passed to Department and Region
  4. Report should be rendered in Report Viewer Web Part

Solution Tried so far
  1. Create a web part that adds two custom drop down
  2. Custom Drop down class that Implements from ITransformableFilterValues
  3. Have 2 Methods on the web pat each having ConnectionProvider Attribute and return instance of drop down control
  1. Even though 2 connection option is shown on my custom filter web part only one can be added
  2. For example - If I connect Filter1(custom web part) to Department then i am unable to connect to Report Viewer web part again.
My web part have methods like this 

custom field type works in view properties, but not in list view: 3 parent fields filter child list,


My situation:

A) odd thing is that no matter where I put a stop point in my custom field type, it is NEVER hit when the items are displayed in list view.  Event with <Field Name="CAMLRendering">TRUE</Field> which causes the list to error out, but again no stop point to help me know why.

B) the value of the column in question will be different for every user who views the list, I'm querying a secondary list based on the user's loginName, and two of the fields from the list we're in. 

C) the display is customized based on whether any records were returned and the current DateTime, so possible displays would be "", "! 12/1/2010", and "7/7/2011"

D) and the text displayed links over to a form for them to do their assignment. the link url would be a config setting url + "?[one of the fields form the list we're in]"

My questions:

1) Is it possible for fieldtype code to execute while a list view is being rendered?

2) If not, then should I chase down the path of a content query webpart?  Will it be able to filter on the current users login name?

3) If not on 1 or 2, can you think of any other way to do this beyond creating a custom application page? (need to having filtering and sorting on this page)

Custom Controls in C# .NET

Embedding user controls in a Windows form is just like adding a simple button or text box that are already provided with .NET. These basic controls were written essentially like you code your own controls. Typically the controls you design are to be used in multiple forms or to modularize your code. These reasons help reduce the amount of code you have to type as well as make it easier for you to change your implementation. There should almost never be any reason to duplicate code because it leaves a lot of room for bugs. So, implementing functionality specific to your control in the control's source code is a good idea. This reduces code duplication as well as modularize your code, which is a good programming guideline.

Writing custom MembershipProvider

ASP.NET Membership mechanism allows to use the build-in server tables to store and retrieve user data. By default, this mechanism can only be used with SQL Server database to which Microsoft provides suitable MembershipProvider class.
Inheriting from this abstract class, developer can use his own table(-es) from any database and use any database engine other than SQL Server, like Oracle, DB2 etc.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend