ASP.NET Controls Filter the Data View

John Hey there,

My name is John Jansen and I'm one of the Test Leads for the SharePoint Designer (SPD) product group. My specialty is data presentation and application building. But I also love to play around with CSS and generic ASP.NET controls. I plan to post tips and tricks here based on questions I see asked in Newsgroups as well as Discussion Boards inside Microsoft.

This first tip is about inserting an ASP.NET control onto a page in SharePoint Designer and then using that control as the mechanism for filtering a Data View on the page. For the purposes of this post, I'm using a DropDownList control because that seems to be the one most people ask about, but you could use a TextBox or CheckBox or anything else and get similar results. The scenario here is that you have a bunch of Categories and a bunch of Products that fit into those Categories, and you want to use a DropDownList to show Products for a specific Category.

To begin, create two lists in the browser: Categories with a field of CategoryName and Products with a field of CategoryName as well (I use a Lookup field type for simplicity, but it doesn't have to be - this code does a simple string compare). Then fill out the lists so you have more than one item in each.

This tip also assumes you already know how to open your Site in SPD and you have created a new page. I realize it is a lot of steps, but I believe they are pretty straight forward as you perform them...

  1. Place your page into design view
  2. Click Task panes :: Data Source Library
  3. Click the data source called Categories
  4. Click to Insert Data Source Control
  5. If prompted, click “Yes” to display the control
  6. Place insertion point below this control
  7. Click Insert :: ASP.NET Controls > Drop Down List
  8. Click the Smart Panel :: Choose Data Source...
  9. Choose the Data Source (for example, SPListDataSource1)
  10. Tell it to display "CategoryName" (or the field that contains your category name)
  11. Make its value "CategoryName"
  12. Click OK
  13. Click to select the dropdownlist control
  14. Click the Smart Panel :: AutoPostBack == True
  15. Drag and drop the Products list onto a page to create a Data View
  16. Clck the Smart Panel :: Edit Columns to add and remove the columns you want to display
  17. Click Data View :: Filter 
  18. Create the following filter:
                    Field: CategoryName (or the field that contains your category name)
                    Comparison: Equals
                    Value: [Create a new Parameter]
                                    Param Name: Param1
                                    Source: Control
                                    Control ID: DropDownList1
                                    Default: Beverages
  19. Click OK
  20. Click OK again
  21. Save the page
  22. Preview in the browser
  23. Make a change to the DropDownList control

OK. That should do it! Good luck.


Comments (167)
  1. Barry says:

    Thanks for the tip. Have you looked at whether it is possible or if there are any issues with Ajax enabling this solution with the UpdatePanel?



  2. spdblog says:

    AJAX here should be fine. You may notice that you can select the view of Products in SPD and click on Data View..Change Layout. Then click on the ‘General’ tab. In there we have a check box to enable sorting and grouping on column headers. That feature uses AJAX-y code.

  3. Barry says:

    Glad to hear it. It would be nice not to pull back down the master page on a refresh within the UpdatePanel.


  4. Paul says:

    How can i set a default value like "Please make an selection" ?

  5. spdblog says:

    Yes. You need to set the properties on the dropdownlist control to do that.

    1. Select the control

    2. click on Task Panes > Tag Properties

    3. change the AppendDataBoundItem to be True

    4. Click the Smart Panel > Edit Items

    5. click "Add"

    6. type "Please make a selection" for the Text property

    7. Click "OK"

    That’ll do it for you.

  6. Paul says:

    Thanks John,

    That does the trick. One other question: how can i use the control to control a listview webpart? I cannot create a new filter in a webpart, only choose from values.


  7. Adam says:

    Hi, thanks for a fantastic article! Very helpful.

    I have go this working with Dropdown, but can’t get it working with either checkboxlist or radiobuttonlist….is there something special I need to do for those please? Thank you.

  8. Brian says:

    Thanks John, your post is quite helpful as resources on Sharepoint Designer are almost non-existent.

    Is there a way to filter the datasource of a second dropdown based on the choice from the first dropdown?  (list of states based on choice of country)

  9. spdblog says:

    Sorry I didn’t see these comments in time to respond one at a time…

    1. Paul, you can’t use this with ListViews because they don’t take parameters in for filtering.

    2. Adam, yeah, you need to code the ParameterBinding by hand, unfortunately. When you follow the above steps, you should have a <parameterbinding location="dropdownlistbox1" …/> tag in your page. You need to change that to this: <parameterbinding location="checkboxlist(checked)" …/> where ‘checked’ is the property on the control you want to evaluate.

    3. Brian, undortunately, not OOTB in this release. You can do this via Javascript, though, if you search for something like "onchange javascript filter drop down". Sorry I’m not more help on that one.

  10. charanmai says:

    How to filter in a ListFormWebPart?

  11. youngbuffett says:

    I thought other users might appreciate my solution the question I posed earlier about filtering a dropdown based on the selection from the first dropdown (list of states based on choice of country):

    <asp:SqlDataSource…  SelectCommand="SELECT * FROM [States] where [Country] = @Country">


    <asp:controlparameter PropertyName="SelectedValue" Name="Country" ControlID="ddlCountry" />



  12. youngbuffett says:


    Could you clarify your response to Adam about filtering based on a checkbox?  I have not been able to get it to work.

    When I follow your steps for filtering on the dropdown, the ParameterBinding looks like this:

    <parameterbinding… location="Control(DropDownList1)" …/>  [note the Control(…)]

    1.  Do we keep the Control(…) for the checkbox, or does it go away?

    2.  Is ‘checkboxlist’ in your example the id of the checkbox list?  The reason I ask is that there is an <asp:checkboxlist> control.

    I have tried the following variations without success:

    <parameterbinding… location="chkID(Checked)" …/>

    <parameterbinding… location="Control(chkID(Checked))" …/>

    <parameterbinding… location="Checkbox(chkID)" …/>

    Thanks, Brian

  13. youngbuffett says:

    Here I go again providing a solution my own question.  I didn’t have any luck with the ParameterBinding, so I replaced the WebPartPages:DataFormParameter (that was created when I added the filter) with an asp:ControlParameter.

    <asp:SqlDataSource… SelectCommand="SELECT * FROM [Table] WHERE [BooleanColumn] = @Condition>


    <asp:ControlParameter Name="Condition" PropertyName="Checked" ControlID="chkTest" DefaultValue="False"/>



    Where ‘chkTest’ is the id of the checkbox on my page, and ‘Condition’ is the arbitrary name I gave the parameter.

    Cheers, Brian

  14. spdblog says:

    Sorry to leave you hanging like that. Your solution is excellent. My solution was typed incorrectly.

    I meant to tell you to do this:

    <ParameterBinding Name="Param1" Location="Control(CheckBox1,Checked)" DefaultValue="foo"/>

    Which I just tested and verified it does work.

    Sorry about the confusion.


  15. JulesAnime says:

    Great post – just what I needed. Is there a way to allow for "All Items" to be returned. I have added a default Item to the list and updated the AppendDataBound Items = "true". This gives me a dropdown with choices "All Items" and then my list of choices, but I want the defualt view "All Items" to return all itmes in the list and not filter them, and then for the user to be able to filter the results. Is this possible?

  16. Bob says:


    Is there a way to have distinct values in the dropdownlist?

  17. lsomers says:

    I’ve used the SPD treeview control with success EXCEPT that, try as I might, I can not figure out how to change the font color and hover color of the linked nodes. I think I’ve changed every style on every style sheet and changed every NodeStyle parameter the TreeView has, yet the text remains blue.

    Worse is that the colors do change in Sharepoint Designer but not when I view the font in IE.

    Can you shed any light on this?


  18. Mat Imtiaz says:

    I am trying to do the same thing, but my column in drop down list is it self a lookup filed. The values shows up as "1;#TEXT" with out quotes. Is there any way to work with this scenario?


  19. Marta says:

    Hello !

    I have the same proble that JulesAnime, wanted to be able to show all the records before being leaked(filtered) on having changed the value of the dropdownlist. There is way of putting a value for default type ‘ all items’ ?

    Excuseme , i don´t speak and wrote well in english.


  20. spdblog says:

    Yes, you can change the above scenario for "All" items to be shown as well, but it can’t be done at the source layer, you need to modify the above to do the filter at the XSLT layer. First of all, add the value "(All)" without the quotes as the selected value in your DropDownList Control, then

    1. Click in the Data View

    2. Click on Data View > Filter

    3. Delete the filter that is set there

    4. Click OK

    5. Switch to Code View

    6. Find the line that says: <xsl:template name="dvt_1.body">

    7. Add a line of code to that template just before the call template:

    <xsl:if test="@CategoryName = $Param1 or $Param1 = ‘(All)’">

    Your code will look like this:

    <xsl:template name="dvt_1.body">

    <xsl:param name="Rows"/>

    <xsl:for-each select="$Rows">

    <xsl:if test="@CategoryName = $Param1 or $Param1 = "'(All)’">

    <xsl:call-template name="dvt_1.rowview"/>




    8. Save the page

    NOTE: Since this filter is now happening in the XSLT, you will see a performance hit. The amount of hit depends on the number of items in your source.

    Good luck!


  21. John Noel says:

    I can do this for WSS 3.0 sites, but cannot for WSS 2.0 sites. 🙁

    The "Insert Data Source Control" option is grayed out for WSS 2.0. How would I do this in WSS 2.0 or I can’t?

  22. Himani says:

    How to add access database in sharep point designer?

  23. Scott Wilson says:

    Just What I was lookinf for.. Thanks!

    This link did the same for me on WSS 2.0 for those that are interested

  24. Rasika says:

    I have a question like this and i want to create a view based on those two

    Say list1 and list2 – list1 is similary to category list, list2 similar to product list however list2 has lookup field for list1 but can include multiple values from list1 in that field, it’s like product belongs to multiple categories (for a given product you can specify multiple categories)

    now I want to have a view, that there’s a list1 (category) drop down that you can select a category and then the products having that category should be listed below. (here this is many to many relationship) i tried using your way but it didn’t work for me)

    tell me on how to do this, and remember that product (list2) has lookup field for category( list1) where you can select multiple categories for single product


  25. Balaji says:

    How to do filter in a ListFormWebPart?

  26. Steve says:

    How do I access the element selected in the drop down list?

  27. chopper says:

     spdblog said:

    Yes, you can change the above scenario for "All" items to be shown as well, but it can’t be done at the source layer, you need to modify the above to do the filter at the XSLT layer. First of all, add the value "(All)" without the quotes as the selected value in your DropDownList Control, then

    1. Click in the Data View

    2. Click on Data View > Filter

    3. Delete the filter that is set there

    4. Click OK

    5. Switch to Code View

    6. Find the line that says: <xsl:template name="dvt_1.body">

    7. Add a line of code to that template just before the call template:

    <xsl:if test="@CategoryName = $Param1 or $Param1 = ‘(All)’">

    Your code will look like this:

    <xsl:template name="dvt_1.body">

    <xsl:param name="Rows"/>

    <xsl:for-each select="$Rows">

    <xsl:if test="@CategoryName = $Param1 or $Param1 = "'(All)’">

    <xsl:call-template name="dvt_1.rowview"/>




    8. Save the page

    NOTE: Since this filter is now happening in the XSLT, you will see a performance hit. The amount of hit depends on the number of items in your source.

    Good luck!


    I did all of this and it does load the page with "ALL Items" but now when i select one of the items in the dropdown the postback occurs but returns no results. PLEASE HELP!!

  28. inspire says:

    I’ve been working on filtering off of a drop down list using both the CAML queries generated by the Filter dialogue box and using XSLT at the call-template level.  While the most recent post on using XSLT does in fact filter everything correctly, it causes an issue with paging.  I have over 1500 pieces of data in the list that I am filtering.  The $Rows parameter holds every single row retrieved from the database.  This is also the variable used to signal when you’ve reached the limit for number of entries per page.  Because XSLT doesn’t use variables in the modern sense of the word, the row counter cannot be decremented every time you skip over an element.  If I have my paging set at 100 items per page, this filter will always return 16 pages of information, even if some pages have no items that fit the filter criteria.  Each list item contains a picture that isdisplayed as a thumbnail on this same page, so showing all of the items on one page to bypass the paging issue is suicide for performance and is just too hard to look at when few values have been filtered out.  Any help is apprciated

  29. Sowmya says:


    I need an urgent help. I have an aspx page where i have 2 textboxes and 1 drop down list. I have a dataview for which the datasource is from a custom list- Assets. Also the drop down populates values from another list – Asset Type.

    By default i want the dataview to display all items. Whenever i enter any filter criteria, i want the rows to get filtered. I have created 3 parameters – 2 for text boxes and 1 for drop down. Kindly advice how to proceed, b’coz when i gave % as the default value for these parameters i checked in the DB , when the query was executed the comparison was done – LIKE ‘%[%]%.

    I am not able to remove the [] brackets. Please advice



  30. Nick says:

    I follow the instruction in article, it works fine. But when I open "Data View Properties" and enable "SharePoint List Toolbar", it doesn’t work, when you change drop-down list, the Data View always keeps same. So, how to fix this problem?

  31. Michael says:

    Hey Chopper and to anyone else who had an issue with the All Items working but the other filter not, try the following:

    1. Smart Panel -> Filter

    2. Click "Add XSLT Filtering…" and then the Edit button

    3. Add the above @CategoryName = $Param1 or $Param1 = ‘(All)’ between the brackets.

    This will get you to where you were in the step above, but without having to go into code.  I did this and had the same problem as you did.

    Turns out, while you can change the column around, and such, sometimes designer doesn’t update the column name.  For example, my column was currently named ‘Category’.  However, originally my column was named Meeting Type.  Hence the variable was actually being used by my XSLT was: @Meeting_x0020_Type  

    Now, you can dig through your code to find the correct name, or do the following: Once you are inside that XSLT filter window, the left window that is labeled "Select a field to insert".  Browse to your colum you wish to filter by and double click it to insert it.  It will show you the current name in the tree menu, but when you insert it it will give you the actual variable name.

    Hope this helps!

  32. Michael says:

    Quick update to my above post.  My environment is kind of wonky, so this may not apply to everyone else but:

    If when you first go into the XSLT edit screen inside the SmartPanel -> Filter window, and you see the following tree structure on your left: dsQueryResponse->Rows->Row but then nothing below on rows do the following:  

    After having checked "Add XSLT Filtering" from the Filter screen, save the aspx page again.  Designer doesn’t seem to populate the XSLT object browser in the XSLT filter editor screen until the page has been saved with this enabled.

  33. Navid says:

    I want  to choose the drop down list data source but when in Data Source Configuration Wizard in the first field I select SoapDataSource1 and then there’s nothing happen !!!

    ( I’m using a Web Service as my DataSource )

    only the 2 next fields become available but thers’s nothing in them and I mean there’s nothing to choose for TextField and Data Field !!!!

    What should I do for DataTestField and DataValueField ??????

  34. Joel Snobohm says:

    Can someone explain in more detail how one filter a dropdown based on the selection from the first dropdown. I have tried this tutorial at the top and got that working. But then youngbuffett came with a comment about my issue and I have NO idea on how to do this.. Any help would be great

    As I said I have the basic tutorial working but i need this last bit to work. Help 🙂

    Contact me on drnibbles at gmail dot com

  35. Johnny Walker says:

    What is the Parameter source and Property name that I need to use to filter by "[current user]" or "Context.User.Identity.Name" when using a SQLDataSource to populate a GridView in SharePoint Designer?  Please email me: sharepointer at gmail dot com


  36. donna says:

    Is there a way to have distinct values in the drop down where the data source is referencing a sharepoint list?

  37. Derson says:

    I am having the same problem as donna, I have this SPDatasource, that is actually a list, and I am using a specific colum that has duplicated values, it’s possible to get read of them?

  38. MartyG says:

    I am wondering how do I filter a data view based on a variable in the page.  Currently I have created a Page Layout based on a ‘Partner Solution’ Site Content Type which has the following Variables (Partner Name(lookup), Solution Name(lookup), description(htmp editor), partner logo(Image Editor), etc…)

    When I create an instance of this page layout for each partner soltuion I want to be able to use the ‘Partner Name (lookup)’ from the assocated site content type to filter the data view.

    I have tried using the control (as each of the columns in the site content type are defined as controls in the page layout) and system variable (cause control didnt work) and used the id as the vlaue but this still does’nt seem to work.

    I then thought it might be something to do with the postback, wheather it was triggering a event after selection.

  39. Christian says:

    Hi everybody!

    Thanks for your awesome comments – I hope you have some awesome comments for my problem 🙂

    I got a Website with a lot of dropdown Lists, which control 3 dataviews and all of them send their information via autopostback to the views. But everytime you choose an option in the dropdown, the postback going to work and send. ( The site actualizes itself. )

    So how do I implement a button to postback manually, to save time and work from the server?

  40. Christian says:

    Hi all

    I solved my problem and need no help anymore – for now 😉

    So for you the information:

    button > properties > behaviour > potbackurl

    here you have to fill in the url of the site you want to post to.

  41. Neha says:

    Hi everybody

    This blog is really awesome and has solved most of my queries regarding dropdowns and filtering.

    But I am just wondering as to how a button can be implemented to solve the above problem of multiple postbacks for multiple dropdowns on page as asked by Christian

    And on top of that – Would be really great if I can get an answer to this 🙂

    How can i get all the filter criterias (like from RadioButtonList1, DropDownList1, DropDownList2, DropDownList3, TextBox etc ) on one page submitted to server on click of lets say ‘Search’ button ?

    And results of these search criteria displayed on another ASPX page like ‘SearchResults.ASPX’ with data in grid form or listview form etc.

  42. Christian says:

    I solved my problem!

    go to the propertiey of your button an you will see "postbackurl" in behaviour. there you simply have to add the url u want to post to and finish!

    the second question is tsimple: just add the url of your searchresults in the postbackurl from the button.

  43. Christian says:

    I solved my problem!

    go to the propertiey of your button an you will see "postbackurl" in behaviour. there you simply have to add the url u want to post to and finish!

    the second question is tsimple: just add the url of your searchresults in the postbackurl from the button.

  44. Stephen says:

    I’ve been having difficutly with parameter bindings on a 64bit system.  The same page works differently on 32 and 64 bit MOSS systems.

    The binding:

    <ParameterBinding Name="Surname" Location="Control(Surname)" DefaultValue="%"/>


    <ParameterBinding Name="Surname" Location="Control(Surname,Text)" DefaultValue="%"/>

    seems to be returning the TextMode property value (SingleLine or MultiLine) rather than the value of the text in the text box on the 64 bit system.

    Is this a known problem, has anybody else experienced it and are there any workarounds?


  45. Robert says:

    Preview error:

    I can manage in SHD steps 1-21 according to the description and it shows data in design mode but when I try to Preview in the browser  it writes:

    An unexpected error has occurred.

    Troubleshoot issues with Windows SharePoint Services.

    Where could be a problem?

    Other aspx pages (NewForm.aspx etc.) are ok.

  46. Stephen says:

    Robert, to get MOSS errors edit the web.config:

    Set CallStack to true in SafeMode <SafeMode MaxControls="200" CallStack="true"…

    Turn off custom errors <customErrors mode="Off" />

    Note: it is recommended you only do this on test/dev systems

  47. Shankar says:


    I got a question. I would like to filter my DataView with a Text box, which I got it working (kind of). However the text should be case sensitive, in other words if I query in something that does not have the same case, i don’t get any results.

    Any help would be appreciated.



  48. Jan says:

    Shankar, can you share your text box solution with me/us?

    I have the following – but its not working:

    <ParameterBinding Name="Param1" Location="Control(TextBox1,Text)" DefaultValue=""/>

    When I provide a DefaultValue, SPD displays the correct filter result. But on the web page no results show up.

    This is my text box control:

    <asp:TextBox runat="server" id="TextBox1" AutoPostBack="True"></asp:TextBox>

    The only control I get to work is the DropDownList.


  49. Jan says:

    ok, it looks like it needed a IISRESET or so. the above solution is working with textbox.


  50. Dan says:

    Is there a way to list only distinct values within a DropDownList using a SP list for the Datasource?

  51. ribru says:

    Hi there,

    i have a problem. I tried to filter a data view with a drop down list. Ive done like stated above but it wont work. I dont understand why. Has somebody a tip for me?

  52. ribru says:

    <xsl:param name="FilePath" />

    <xsl:param name="Param1">Vista</xsl:param>

    <xsl:variable name="Rows" select="/table/data/row[contains(normalize-space(col [ 6 ] ), $Param1)]"/>

    Here some code from me. If the default value of the drop down list is vista the filter works but whatever i select in the drop down list the page reloads and the data view is filtered with vista.

  53. ribru says:


    if i use only SharePoint Lists like in this article it works. I use a xml data source and i think this is the problem. Somebody an idea?

  54. John says:

    Is there any way to make the filter optional?  Meaning is there any way to allow the user to see all rows in the list?

  55. ribru says:


    look @ July 28, 2007 5:24 PM

    1. Smart Panel -> Filter

    2. Click "Add XSLT Filtering…" and then the Edit button

    3. Add the above @CategoryName = $Param1 or $Param1 = ‘(All)’ between the brackets.

    You can define ‘All’ as default. Works fine for me!


    My Problem still remains unsolved. How can i filter XML datasources? With Lists its no Problem but XML data sources it wont work. Only the default filter shows up.

    Hope some DEV has an idea.

    bye Richard

  56. Mike says:

    Hello there,

    I’ve this problem that I just can’t seem to resolve:

    I put a control with an sqldatasource just like this:

    <asp:SqlDataSource runat="server" id="Interlocuteur" ConnectionString="blabla" ProviderName="System.Data.Odbc" SelectCommand="SELECT * FROM Annuary WHERE  Annuary.SocietyName=@newparameter">


    <asp:controlparameter Name="newparameter" ControlID="TextBox1" Type="String" DefaultValue="k"/>



    but I get an error on my page, it doesn’t seem to know the value of my Control

  57. MichaelSPD says:

    Hi my sqlDataSource with the code like this:

    <asp:SqlDataSource…  SelectCommand="SELECT * FROM [States] where [Country] = @Country">


    <asp:controlparameter PropertyName="SelectedValue" Name="Country" ControlID="ddlCountry" />



    doesn’ t seem to work with Sharepoint, the control doesn’t have any value

  58. Sergio says:


    I’m trying to filter a Data View, which i have place in a DispForm, with a sharepoint control  (SharePoint:ListItemProperty). I have created the paramenter with this control, but it doesn’t works. Why? Any idea?


  59. Ovi says:

    I have a SQLDataSource that I need to pass the current user name to in order to filter the data.  Can someone suggest a solution?

  60. Kevin says:

    Is it possible to use this ASP dropdown on a Custom List Form in Sharepoint?  I created a new Form that works fine when I click New on the wss calendar, but when I try to the asp dropdownlist, I get an "unexpected error".

    Any thoughts?

  61. McGraw says:

    I have a sql view data source on a page and I’ve also added a date filter.  My data source has begin and end date columns.  I’d like to be able to select and date from the date filter and have all rows displayed where the date selected is between the begin and end date.  Can the value from the date filter be accessed by the data source filter using a parameter? I haven’t been able to make this work.  Any suggestion would be appreciated.  

  62. Dave says:

    new to SP designer, filling in for the programmer (who was fired)… I followed the instructions down to step 18.

    Per the instructions, I created 2 lists and a new page, opened it up in SP Designer, inserted data controls for "Categories" and ASP.Net Drop down, I chose the data source using SPListDataSource1 and selected "CategoryName" for the other 2 fields, set Postback = True, drug and dropped Products list onto the page.  Once there I edited the colums and clicked on Data View::Filter.

    Now the issue…… I selected CategoryName for the field, Equals for the Comparison and creted a new parameter called Param1, set to control but my Control ID field is blank.  I cannot select DropDownList1.  What did I do wrong?



  63. Sunil says:


    I am able to filter with a dropdownlist and tried using the checkbox list by using your suggestion.

    i.e <ParameterBinding Name="Param1" Location="Control(CheckBox1,Checked)" DefaultValue="foo"/>

    If I am giving some defualt vaule, then its filtering based on that value. but if I select anything else, its not wokring.

    Any help whould be highly appreciated.

  64. Dave number 2 says:

    Hi, great post!!

    Of course its not working exactly as planned…

    I have two drop-downs filtering one list – it works fine with this xslt filter:

    [(@Category = $Param1 or $Param1 = ‘(All Categories)’) and (@Community = $Param2 or $Param2 = ‘(All Communities)’)]

    HOWEVER, when the page is FIRST loaded, the default results aren’t shown – it is blank. I guess I could solve this by loading the page and automatically posting back, but this obviously isn’t a good idea.

    Is there any way to have the results of the filter be shown on the page when it first loads?


  65. Dave number 2 says:

    Okay, I answered my own question, sort of, I have a work around anyways.

    In addition to what I did as explained above, I also did what the poster said on March 15, 2007 7:38 AM. I appended an item called "– Please select a value –" but in the VALUE field put in the ‘(All Communities)’. Seems to work, now when the page loads I still have all of the default values showing up.

    Dave #2

  66. Nick Eales says:

    All of this doesn’t work as soon as you use a wss 3.0 masterpage. It works fine in an empty aspx page.

    With the masterpage the parameter is always set to default and never picks up the actual selected value of the formfield.

  67. Alana says:


    This is a cool post.

    I’m trying to sort the drop down list in alpha order. However, whenever I do this my data source gets the following error: Duplicate Component Name ‘spdatasource5’. Component names must be unique and case-sensitive.

    Anyone got any clue why this would be happening?

  68. Deb S. says:

    Hi Jon,

    I have reviewed your Demo’s six part series.  I thought they were very helpful.  Thank you.

    I just started working with SharePoint.  I have bought books on sharepoint and browsed ther internet for information.  I have some ASP.Net experience.

    Two things I need to do right a way is design a great looking master page using a team template and the other is to allow internal company users and unkown users to our SharePoint site perhaps using Forms authentication, login/register.  I’m not sure if I’m going to use SQL server asp provider.

    Can you point me in the right direction on these two items?.  Any videos on them?  

    Thank you.

  69. Kevin says:

    Hi John,

            Can we use a similar approach to filter a datasource inside a DataFormWebPart ? Let me give you the scenario, I’ve got a department list and a section list on my Site. I want to customize the newform of another list to be able to add Cascading DropDown Functionality for selecting a section ( Department->Section) as follows:

    1. Created a datasource (1) to pickup all departments ( Note that Department Field does not exist in my actual list, only Section Field )

    2. Connected an ASP.Net Dropdownlist to the Datasource (DropDownList1) with AutoPostBack

    3. Create another datasource (2) to pickup the sections – Here I inserted {DepartmentName} as parameter in the CAML Query of the Select Method

    4. Linked the Parameter using ASP:ControlParameter to the DropDownList1.

    5. Added a Sharepoint:DataViewDropDownList, linked to the Section Field of the actual list and also linked to datasource (2)


    On opening the form, the list of departments and sections are filled correctly. When selecting another department, postback is performed but the section list does not get refreshed. Is there a fundamental thing I’ve missed out or this kind of implementation not possible ?

    Thank you

  70. Mark says:

    Is there any way to use the following field as input for the filter?

    <SharePointWebControls:TextField FieldName="Company"  runat="server" id="TextField1"></SharePointWebControls:TextField>

    We tried to do the same trick with  Control(TextField1,Text) but this isn’t working.



  71. Sean says:


    Tried the dropdown dataview filter instructions and it worked perfectly

    I have now set it up to filter on the modified by Field

    I get some strange results in the drop down that includes the the persons name , email etc

    eg. 37;#Sean ,#xxxxyyyyyyy,,#,#Sean

    The x’s and y’s I used to replace the original data

    How can I get it to display only the persons name

    Thanks in advance



  72. gbelzile says:


    The drop down filter is not quite working for me.  It seems like it only work when the page is a postback.  I can’t get the default value to work.  When I first load the page, I don’t see anything.  Then when I change the value of the dropdown, I see my item filtered correctly.

    Any idea?



  73. krystie says:

    Hi John,

    This post was really helpful – thank-you! I’m having a problem though, when the column I use in my drop-down list is a calculated column. My formula in the calculated column is: =TEXT(Date,"yyyy") so that I can see the Year of an entry from the Date column. However, when I preview the page in my browser, the years show up in the drop-down box as ‘string;#2008’ etc. Do you have ideas about how I can get it to just display the years properly?

    Thanks, Krystie

  74. RonieR says:

    Has anyone figured out how to get the select all feature to work yet?

  75. DeeDee says:

    Hello everyone,

    Try as I might, I can not figure out how to change the font color on the Quick Launch menu on the left-hand side of the site. I’ve successfully changed the font color in the .css code and made sure it was so when I right-click the quick lauch area to modify the style (to the color white that I want it to be instead of that default blue);the text color do change in Sharepoint Designer but not when I view the font in IE- it remains blue.

    Would anyone be able to shed any light on this?


  76. Panagiotis Kanavos says:

    Regarding Nick’s post about the Toolbar bug on July 28, the DataFormWebPart does not pass the parameter values to the CAML query when the "Sharepoint List Template" option is selected. You can solve this easily though, by copying the code generated by that option outside the DataFormWebPart. Just move all the code contained in the table starting with <table class="ms-menutoolbar" … .

    There is another bug that I have noticed with SPD. Adding filters to the DataFormWebPart breaks folders. Even when you navigate to a folder using the Treeview, the DFWP only shows the root folder. This happens because SPD removes the RootFolder QueryStringParameter from the SelectParameters of the DFWP’s datasource. Just add the missing line, <asp:QueryStringParameter Type="String" Name="RootFolder" QueryStringField="RootFolder"></asp:QueryStringParameter>, to the SelectParameters.

    Finally, there are problems when creating a list template that includes a view that only creates a DFWP. When a new list is created using this template, the DFWP is replaced by a ListView web part. To overcome this, add a hidden ListView web part to the view.

  77. shivamoss says:


    i need help i am working on the look and feel of the page using sharepoint designer

    what i have done is i have copied a default theme(verdant)and made changes to the

    Cust1011-65001.css and replace the content of "C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATETHEMESCustomBrowntheme.css

    the changes are seen when the changes are made but when i replace the content of "C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATETHEMESCustomBrowntheme.css

    and when perform the application pool recycle of that web application and when i opened the Cust1011-65001.css file the number of lines of code got increased by itself and copy of ms-pagetitle was not changing and had a default color # eaffbc was seen  with the default  url of the image even after mnaking the changes again and again the same thing is getting repeated

    please help


  78. shivamoss says:

    John Jansen hope you are doing great

    i am new to this …..i have 2 issues the one which i just posted and another is that the client is asking me to change the color of the text to black color which is on the side and global  navigation

    so please tell (guide) me where shoule i do that and how



  79. LISpeedyG says:


    I am having a problem on the "Receiver" DataFormWebPart (DFWP) on postback when the "Provider" DFWP retuns a Null.

    The above connections are made using a filter from the Provider to the Receiver.  A text box is used to filter the Provider DFWP using a "Contains" query.  And, on occasion, if the user inputs data that is not found the Provider DFWP does not return any records.  However, the Receiver DFWP returns the previous data rather than a Null.

    Is there a step that I am missing to initialize the Receiver prior to each request?

    Thanks for the help

  80. Balaji says:

    Can u please guide me how to set the filter using a Textbox with a Button

  81. AFAWZI says:

    Hi all,  i connected a form web part with checkboxes with List web part in Data View web part, this web part is uesd to display the username and the number of checks that user checking from the form, so when user X checks 3 checkboxes , the list will display the username X with the number of choices which is 3. The problem is when user X is loged in again, and checks another 2 choices, i wanted the list to display the user X with 5  choices (by adding 3 + 2) once. but what i get is that it displays user X twice, the first one with 3, and the second one with 5, what i need is to get distinct data in the list. any one can help, please i need to solve this issue as soon as possible 🙁

  82. John says:

    Is there anyway to filter useing a date from a datepicker instead of a drop down?

  83. BING says:

    Hi all, need help to set a filter with Textbox and DatePicker here. Only combobox work on my site.

    Thanks for the help

  84. Desi says:

    I am using a calculated column as a source and what I get is string;# before the value. Is there any way to make this disappear?

  85. Raman Deep Kasnia says:


    I want to display assigned task of currently logged in user while entering time entry in timesheet.

    In "Tasks Worked On" field, i can see all users tasks, i want to do with share point designer, i m trying to do it from last 10 days, please help………..

  86. DarthVader says:


    Thanks for the post- as a SharePoint newbie you just saved me a bunch of time getting to my document library in a nice way. Really appreciate it!

    I’d like to display a list of documents, like my document library, but with checkboxes at the left. User selects one or more items, presses a button, and I perform an action on each selected item in turn. For example, you could select a dozen items and kick off a workflow for each one using this UI. I have ideas about it, but would love to hear how you’d do it.



  87. spdblog says:

    Hey Darth,

    Unfortunately, that is not as easy as it sounds. I wrote some jscript to do that once, but it was pretty buggy due to the dynamic nature of the view. In mine, I inserted the checkbox, then converted the Title of a document in the view into an asp:Label control. Then I wrote script that said "for each checkbox, grab the innerText of the next table cell and do something cool".

    Not great.

    Someone else who visits here may have a super creative way of doing it, but I haven’t really had time to nail one down yet.


  88. spdblog says:

    To John up above, about the DateTime question. Yeah, you create the parameter the same way, but change it so that it passed the SelectedDate attribute on the control:

    <ParameterBinding Name="Param1" Location="Control(DateTimeControl1,SelectedDate)" DefaultValue="foo"/>


  89. Roennow says:


    How do I make this scenario work i SPD:

    1) Calculating a Year based on current date (ex: current date between 8/1/2007-12/31/2007 -> 2007, current date between 1/1/2008-7/31/2008 -> 2008)

    2) Data Source Control referencing a SharePoint List (with field representing Year)

    3) RadioButton list exposing values (from another field in the SP List) filteret by calculated Year

    Can anyone help ?

  90. pkanavos says:

    To John and spdblog about passing a date as a parameter.

    Unfortunately, it’s not that easy. The SPDateTimePicker control returns the date as a US-formatted string, causing the CAML query to fail. I solved this by creating my own date time control that inherited from SPDateTimePicker and added a SelectedValueISO property that returned the date formatted in ISO format.

  91. AnandhRaj says:

    For Dropdown list filter in dataview

    just have a try with this

    First add the item as  All in dropdownlist and

    initally in dataview – > rclick ->parameter

    new parameter let say param1

    select  source -> control

    control id -> urdropdownlist

    dataview -> rclick

    filter->add xslt fil -> edit

    it shows [ ]

    after [ if u press u ll be getting list of fields there select ur field

    for example  consider the field as deptID

    so it should be like this

    [@deptID = $param1 or $param1 = ‘All’ ]


  92. AnandhRaj says:

    For Filter through drop down list

    dont forget to set the property of dropdown list


    AppendDatabounditems   to true

  93. Jarrod says:

    I am new to all of this and need a little help, I have created my custom list and have the page with drowns the way i want it, what do I need to do from there, I have already gone to the NewForm and gon to the main master and replaced it with a custom list so I can see everything in designer, I just need to know how to setup some colums for the drop downs how to link the drops downs….. well everything with kid gloves.

  94. David says:

    Has anyone managed to get the ‘view all items working’ as everytime I try this the filter stops working?

    Anyway got any tips?


  95. Deepthi says:


    I have used this for displaying my list of projects in a dropdown in Newform of Contacts list. It worked fine. But now I want to see the value which has been selected in the dropdownlist displayed in the dispform as well as in the edit page the value which has been selected while creation and saved has to be selected. And upodation should also be done when edited.

    Can anyone help me please?


  96. Tim says:

    Hi, this was a great post, thatnks. Did anyone manage to get the suggestion youngbuffett made on filtering based on the results of a dropdown going? Like everyone, searching for a resonable solution to problem described where you pick a State based on a Country selection.

    Thanks a lot


  97. Clare Selley says:

    I’m having trouble with paging. I’ve got a nice drop-down box working (autofilled from a SQL database) and filtering an SQL datasource. However when I go though to, say, record 21-30 and then select another selection from the drop down box, the records still start at 21-30 and I have to click ‘start’ on the paging to get me back to 1-10.

    Any idea how to tell it to filter & set the view to 1-10 when the selection is made?


  98. Rithwik says:

    Hello John,

    I have a filter where in the based on the user profile the page gets displayed.

    One of the filter has ‘R&M’ as the text. the filter does not work with the ‘&’ When i change the filter condition to ‘RandM’ it works.

    Could  you please help.

  99. Patrick says:


    For those of you having trouble binding a parameter to an asp TextBox <asp:TextBox runat="server" id="TextBox1" AutoPostBack="true">, I don’t think any comments have addressed this, so I am going to post.

    To bind a parameter to a textbox everyone was trying to use

    <ParameterBinding Name="Param2" Location="Control(TextBox1,Text)" DefaultValue=""/>, but this will just return the TextMode when trying to use $Param2.  

    Instead set the location to Form(TextBox1)

    <ParameterBinding Name="Param2" Location="Form(TextBox1)" DefaultValue=""/>

    Now $Param2 will give the value in TextBox1 !

  100. Spandana says:


    We have a dataview webpart along with a filter(dropdown) associated with it.. we are facing a strange problem. once we select the value from the filter the data is getting populated in the dataview webpart however the value selected is not getting retained. please let us know the fix for this.

    Thanks in advance

  101. says:

    Hello Friend,

                     My problem is regarding editing the Newform.aspx of my list. What i need is  to  autopopulate/autoselect  a dropdownlist according to a selected value in another dropdown. I will explain in detail. I do have a list that contains TaskId and TaskDescription.

    Say Like T100 taskid corresponds to a task description "Collect Details from a customer", T200 taskid corresponds  to a taskdescription "get Feedback from Customer B".. Likewise.    And i do have another list which have 2 dropdowns Taskid and TaskDescription. What i need is to Autoselect a taskDescription item in TaskDesription Dropdown according to the selected TaskId. Only This change i need to have in Newform.aspx of my sharepoint List.How can i …. Plz help me up…

  102. CCML01 says:

    Trouble with binding a parameter to a textbox:

    <ParameterBinding Name="Param2" Location="Control(TextBox1,Text)" DefaultValue=""/> -> Does not work (in fact, works sometimes, depending mostly on IIS Reset… Works for a while, then stops, then works again after IIS Reset…) BUT …

    <ParameterBinding Name="Param2" Location="Form(TextBox1)" DefaultValue=""/> -> Does not work at all (at least here) !

    That’s very nasty, because I urgently need this kind of filtering !

    Any idea ?


  103. Paul K. says:

    Ok John,

    you have taught me a good amount of development in Designer. I subscibed to your Total Training Videos and have two question that are very important.

    you do thie example above with a Dropdown list. I need to do it with a Textbox. You have this on the video training, but when following exactly my filter doesn’t return anything after postback?

    and Second: what is the best way to form (data) validate? I can’t find a tutorial, if you could point me in the right direction.

    thank you in advance,


  104. Noel says:

    Hi John!

    Good Day!

    I have read from this post that at lot of people are also experiencing the same problem i have, on how to pass the current user name to an SQL Data Source as a parameter.

    I hope you can share, or anyone from this post, some solutions to it.

    Thanks a lot!



  105. serguei says:


    I´m trying to filter a data view based on a textbox input (using "contains" comparison), how can get it?

  106. Graham says:

    Not sure a solution was posted to the issue of TextMode being returned from the asp:textbox control when used as a ParameterBinding control.

    The Location=(Control) is expecting a "Value" property.  Putting Location=(Control, Text) you think would fix it and i’ve seen it work, but not consistently, So I wrote a quickly extension of the textbox class with a Value Property…  Works great…


    Imports System.Web

    Imports System.Web.UI

    Public Class TextBoxWithValue

       Inherits System.Web.UI.WebControls.TextBox

       Public ReadOnly Property Value() As String


               Return Me.Text

           End Get

       End Property

    End Class

  107. spdblog says:

    I apologize for my lack or response here. Yes, it turns out that the Textbox control has an issue because it passes its properties to the page in an arbitrary manner. That is: this fails when the TextMode property is passed in before the Text property. Since the order is arbitrary, an IISRESET will sometimes correct it and then another IISRESET will break it again. I have been working on a way to get this working consistently, but as yet have come up empty.

    As for validation, I simply put an asp validation control on the page (from the toolbox) and use that. You can’t use it with FormField controls, but if you convert the FormField into a TextBox, then you can.



  108. Ram says:

    Hi john

    Very effective document

    but i am stuck on some issue,actually i want to create a archive of news

    and i m picking the data from share point list named news1

    how can i do this ,i need your great support to solve this, please help me other i will miss my project deadline.

    Actually  in my share point list i have columns "newsmonth" and "newsyear". and i have to pick up the news corrosponding to these columns.

    Please help me


    Thank you

  109. sharavathi says:


    I am trying for multiple filter option.

    I have taken a simple form webpart, which contains multiple checkboxes.

    and i have a dataform webpart to apply filter criteria and search the result based on checkboxes selected from form web part.

    I have written some javascript code to appy the condition and submit the for to url.I am passing parameter through url. I am facing problem to display all the items if no parameters are selected.

    Please help me.



  110. Bobby Vastakis says:

    Hi all,

    Great blog.  Many of the comments have to do with a drop down filter pertaining to a data view.  Can I perform/set up a similar paramater for formview.

    I have two tables (employee and interview).  I want to have a drop down list that displays the employee names and shows the corresponding records from the interview table.  I want the ability to edit/insert/update/delete records from the interview table as this time.



  111. I am having the same problem as ribru above.  I can get this to work great on list and Web service datasources but NOT on xml data sources.

    Please help.


  112. Uzma says:

    Thank you! It’s just what I was looking for an event listing for my company!! Many thanks.

  113. raj says:


    every one in this blog are doing a great job. especially my thanks to John Jansen and other guys who are solving our queries.

    I had a problem in geting solution for the requirement: Where i am having a data view from cross lists and lists are considering from subsites of a site and with same content type.

    the problem here is..I want to provide a linkable/clickable column on the data view, where on click of it should redirect to that list item edit view or else to the site where the clicked item list exists(means parent site of that list item).

    Please can any one solve my requirement.

    I hope i am clear with the query.



  114. nh says:


    Similar to the problem Inspire had faced, i am also working on the filtering off of a drop down list

    It  does filter correctly but it causes an issue with paging.

    If there are about 1000 rows. The $Rows parameter holds every single row retrieved from the database.  

    Suppose there are just 50 items matching our filter. Still it returns all the pages with blank items.

    i dont know how to stop it and sort it so that only the filtered rows are shown.

    Please help.

  115. Shashank says:

    Hi John

    I am new to share point

    In my page I have 2 web parts with list Items.

    Web Part1 will have Selected Items

    Web Part2 will have un selected Items based on field "Selected"

    Item Name        Selected

    1                        Yes

    2                        Yes

    Item Name        Selected

    3                        No

    4                        No

    In my web part  have to show a column "Selected" with drop down list with Yes/No Values.

    When users changes the values it should go to corresponding web part

    my requirement is I have show drop down list in selected column.

    when yours selects different value it should go to corresponding web part.



  116. Vinay says:

    Hello all,

    I have a doubt, when i apply filter to didplay data according to dropdownlist value, i want to see complete table intially then it has to filter acording to the dropdownlist value, can any one help in this.

  117. fk says:

    Thanks for the great article. However I am faced with the same issue, textbox control filter behaving unpredictably. Sometimes though an iis reset fixes the issue.

    Did any one figure out a solution for this?

    Thanks in advance

  118. Netta says:

    I’m trying to filter a list using multiple drop down menus : currency, dimensions and file type.

    I used the "AutopostBack and controls" method to build the filters.

    But now I got a problem.  what I need is to be able to get results immediately after each filter is chosen,  and not have to always choose all 3 filters.(the way it works when using the SharePoint filter web parts)

    That is, If I choose dollar in currency filter I want to get all the “dollar” items, then if I add file type  : jpg I want to see the ones that have dollar and are jpgs.

    I can’t seem to get it right.

    If I choose “and” in the data view filter – I don’t get any results till I choose all 3 filters

    If I choose “or” I end up with all the items that are “Dollar” and also all the “jpgs” instead of items that are “dollar & jpg”.

    I’m sure there must be a way to get it working.. any ideas ?

  119. contoisd says:

    I have tried to filter dataformwebpart using a dropdown list as per instructions in this post, however I have not been sucessfull.  My dropdown is a lookp from a sql query from our EPR system (ie Project Number).  I want to filter my document library to only show documents from the Project Number in the drop down list.  

    Here are the steps:

    1) insert dropdown, insert datasource (sql query from erp system)

    2) set data field and data text field, autopost back

    3) insert sp doc library as dataview

    4) filter dataview with new param1 from control dropdownlist1

    When viewing the page, the document library is not filtered and returns nothing.

    I’ve searched everywhere to find how to bind a dropdown to a sp list of doc library and have had not luck.

    Thank you for your help.


  120. contoisd says:

    With respect to my post on dropdown not filtering,  the filtering works when I use the document library as the datasource for the dropdown, however when I use a sql query for lookup for the dropdown list, the filtering does not work.

  121. chewbanda says:

    HI Im a new comer for this site. I have one questions.

    I need to create a drop down list on the page and based on that i need to filter a multiple look up. as a example if i select categary1 in the drop down list it should populate the lookup column with the filtered data. Can we do that??


  122. Gezmo says:

    Hi thanks for greate article, for me I could filter the data using both specified value or All from the dropdown list control but I found difficulty to use the approach with grouping option in the dataview.

    Where exactly to place the condition to let the filtering working correctly if we have grouping option in the view.


  123. Will Dieterich says:

    I got the textbox to work!

    I was goofing around and did as everyone else has done for text box, then I went and swiched the line

    <asp:textbox runat="server" id="textbox1"></sp:textBox>


    <input id="textbox1" name="textbox1" type="text"/>

    then with using a form(textbox1) instead of a control(textbox1) everything works.

    I can set the filter in the dataview and it reads in,even with a reboot.

  124. Ned says:

    Has anybody figured out how to get rid of duplicates showing in your dropdown? There were a few people asking this but I haven’t seen an answer, I’ve tried almost everything to get rid of them. I know I can make seperate lists but I don’t want to do that.

  125. Satheesh says:

    Any updates on the textbox problem. It is still a problem. When we use the html control like

    <input id="Something" name="Something"/> then it reads the value, but if you enable paging, and do a post back then value is not retained and it stops working.

    We can use javascript and onload event in html to have a workaround.

    Any direct method of making this work



  126. JM says:

    Great post. This exactly what I was looking for.

  127. Zafar Iqbal says:

    This helped me sort out an issue, which was related to this parent > child heirarchy, but that was on the same list.

    I am using this to show a dropdown where user will select an item, and then in the second dataview I am displaying details of that item.

    However I noticed that I had to create a copy of the list source and used it to populate dropdown and main list source was used to display item.

    Till now I am only able to display items when I have choose multiple item view settings for dataview.

    Is there any way around for showing editable view of that item?

  128. Marsha says:

    How do I filter a data form based on a variable in the page?  I have the user name populated on the page based on the person logging in.  I want to use this information to filter a mulit line form.  Ideally, I want to use a button to iniate the filtered form.

  129. Khalid Rana says:

    Hi There,

    What a great post almost got me to where I need to go.

    How can you create a drop down based on "Choice Items" created within a column of a sharepoint list?

    Then send filter values to the second and third drop down list.

    The last drop down list has to "Send to web part connections"

    Sorry if this is asking too much at once.

    Thank you,

  130. Carolina says:

    Thank you…this was very helpful.

  131. joel says:

    To remove duplicates from your dropdown you need to alter the select query of your data source, once you have found the correct location this is basic SQL.


    Click to select your data source >> in the "tag properties" task pane find "SelectQuery" >> click the ellipsis (…) to edit the query

    Insert the DISTINCT keyword into your query, for example –

    SELECT DISTINCT Category FROM [v_SPARQ_ERP_report_register] WHERE [Stream] = @Stream ORDER BY Category ASC


    Click to select your data source, or find the line in your code e.g. <asp:SqlDataSource id="SqlDataSourceCompany" >> Find the "SelectCommand" attribute.

    Insert the DISTINCT keyword into your query, for example –

    SelectCommand="SELECT DISTINCT CompanyName FROM [v_SPARQ_ERP_report_register] ORDER BY CompanyName ASC"

    Hope that helps, Joel

  132. Nick says:

    Thanks for that tip/help! I have been searching for hours and finally came across this site.

    It worked like a dream and so easy too!….although I did get a little confused about adding a new page ..I wasn’t sure if I should add a normal html or aspx. L earned that SPD converts the basic page to a aspx when saved.

    Also wasn’t sure what you meant about the smart panel, and soon realised this was the little right pointed triangle on the control source added to the page.

    Anyway, Cheers and thank you!

  133. Syed Gulam Abbas Naqvi says:

    <ParameterBinding Name="UserGroupName" Location="Control(TextBox1.Text)" DefaultValue="SIGroup"/>

    Instead of using Location="Control(TextBox1,Text)" use Location="Control(TextBox1.Text)", in which ‘ , ‘ is replaced with ‘.’

    Try using the code give above, using this I save my 3-4 four days which I was going to waste, thank god.. hhhuuuuuffffffff.

  134. Syed Gulam Abbas says:

    Instead of using ASP.NET control in ParameterBinding use html control and set runat=server and use following code

    <ParameterBinding Location="Control(txtHtmlTextBox,value)" DefaultValue="" />

    This has shown great persistency even if you reset IIS n # time.

  135. Prashanth says:

    Awesome Joel …. this is wat i was looking for .. thanks man appreciate it …


  136. Amit Jha says:

    Hi Every one

    I have a requirement  for filter drop down. I have to display the item in drop down in most recently item should comes first.

    I have a filter drop down called due date. so if any new item inserted in the list than the value of that due date should come first in filter drop down.

    any solution for this?

  137. Salil says:

    I am using Data View Web Part to combine 22 Document Libraries for Corporate View.

    Everything works fine, expect that the Filter DropDowns have Dupliacte values.

    Any solution gurus ??

  138. Salil says:

    I am using Data View Web Part to show data from 22 Doc Libraries in my page. I have enabled the Filter & Sort features of this Web Part. However the 7 Drop Down Filters are having duplicate values.

    Please find below the code snippet of the page from SPD,

        <xsl:for-each select="msxsl:node-set($dvt_Rows)/*[not(@*[name()=$dvt_FieldNameNoAtSign]=preceding-sibling::*[1]/@*[name()=$dvt_FieldNameNoAtSign])]/@*[name()=$dvt_FieldNameNoAtSign]">

          <xsl:sort data-type="{$sorttype}" />

    When I remove [1] from it

        <xsl:for-each select="msxsl:node-set($dvt_Rows)/*[not(@*[name()=$dvt_FieldNameNoAtSign]=preceding-sibling::*/@*[name()=$dvt_FieldNameNoAtSign])]/@*[name()=$dvt_FieldNameNoAtSign]">

          <xsl:sort data-type="{$sorttype}" />

    My page is not rendered. And I still have the dupliactes in the Drop Downs.

    Please let me know how to get rid of the Duplicate values.



  139. Michal says:

    Hi John,

    perfect article, that was exactly what I was looking for. But I need more :-).

    Is it possible to filter with DropDownMenu also Gantt view in SharePoint. Because I need to filter data in SubProjects/Task list by Project name and would like to show also Gantt charts for specific SubProjects. Normally it is possible just by making custom view in SharePopint by adding filter parameter, but I want to make it dynamically.



  140. IT_Cowboy says:

    Great, lots of good information here! but I have one little issue with using a checkboxlist that I don’t understand. The dropdown list works, but the checkboxlist works the same way, meaning that if I check one box, it works with that box checked, but if I check two boxes, it only posts with the latest one checked. I need to filter by any and all boxs checked.

    <ParameterBinding  Location="Control(CheckBoxList1,SelectedValue)"

    Now I think that I need another control or string, and someway to post to the control to add/remove values as they are checked, but I do not know how to go about this in Sharepoint designer..I already tried disabling autopostback on the checkboxes and adding a button to postback, but that only shows the top value checked, instead of all of them.

    Can anyone help?

  141. Shankar.S says:

    Filter Data view based on the selected value from Dropdownlist and Radiobutton List

    1.Create Paramters

    <xsl:param name="ListID">AFF375A6-1C8B-4C98-8B0E-60AD2F67C0B8</xsl:param>

    <xsl:param name="Param1" />

    <xsl:param name="Param2" />

    2.Include the control in the Parameter binding

    <ParameterBinding Name="Param1" Location="Control(cbSoftware)" DefaultValue=""/>

    <ParameterBinding Name="Param2" Location="Control(rdDocumentType,SelectedValue)" DefaultValue=""/>

    3.Add the Filter condition

    <xsl:for-each select="$Rows">

    <!– Filter –>

    <xsl:if test "(@Software=$Param1 or $Param1 = ‘ALL’) and (@Document_x0020_Type = $Param2)">

    <xsl:call-template name="dvt_1.rowview" />



  142. Nasir says:

    Hi Everyone,

    I have tried to use two sharepoint:dropdownlist like cascading dropdown approach (e.g When selecting country in one dropdown it filter cities in other dropdown). I tried based on tip from Youngbuffett but not succeeded. Your all help highly appreciated. Thanks

  143. Rob says:

    I was able to use the dropdownlist to filter a DVWP where the data source is a SharePoint list.

    However, when I try to use the process on a XML data source (XML File) it does not work.  There have been a couple of other responses (ribru on 10/30/2007 and James McDowell on 11/10/2008) that indicate the same thing.

    Yes – autopostback is set to true on the control.

    I am displaying the parameter in the DWP to see if the value ever changes but it only displays the first value in the dropdownlist even though the dropdownlist shows the value I selected.

  144. Kalpana says:


    I’m building a simple document approval workflow using Microsoft Office SharePoint Designer 2007 for a document library. One of the requirements is: When a user initiates the workflow for a document he/she must be able to select one or more approvers. I’m using a column called "Approvers" of type "Lookup" with multi-select option enabled. I have a custom list containing a list of users and use this list to populate values for "Approvers" column.

    When the user selects one or more approvers, I need to create tasks for each one of them to review the document and approve or reject it.

    Can someone please let me know how to retrieve the selected values from the multi-select lookup column, in the SharePoint Designer 2007, in the workflow design wizard?



  145. Praz_M says:


    I have two lists,->  the Project list and the Project Task list,

    When i select any project from the project list, it should display the details of that project and in the other list which is placed just below the project list, all the tasks related to that project. Right now, I am not able to see the List of tasks related to a particluar praoject.

    Is there any way, where we pass the Project name of Project list to the Project Task List and display filter them by the Project name to display only does tak with the same Project name.

  146. Juan says:

    I struggled for 2 days to figure this out! Comes from trying to hard code instead of using the wysiwyg! Thank you! Your help is greatly appreciated!

  147. Prakash says:

    Hi spdblog!

      thanks for this article, i did it correct but after these steps i need to set the selected value for dropdownlist (for now showing the first item of the list) obviously corresponding dataview details on page load. how??? i need ur help urgently.. plz…

    thanks in advance

  148. Barry says:

    Great post. Really helped. Thanks

  149. curtsky says:

    I am new to Microsoft Sharepoint designer 2007. I tried many times to filter (Common data view task>filter)  the data soruce with created < current date or created <= today -1 , I don;t know where to input. anyone can help.- desperate.

  150. Ginger says:

    Just what I was looking for!  Thanks for sharing.

  151. kav says:


    i chosed spdatasource and Select data field to display in dropdown but it come with all the items from that selected colum

    like #work,#work,#work,#work,#home,#home instaed of



    in drop down

    how to filter this?

    i will be very thankful of you if you give me right direction.

  152. Jeff says:

    Similar to Prakash’s post of 1/7/10, I would like to set the selected option to the first option in the list.  I’ve set things up just as directed in the article, but when the page first posts none of the options in the dropdown is selected (I’ve looked at the HTML via view source).  Therefore, the DVWP shows no matching items.

    If I select the second item from the dropdown, the selected option property is set, and the DVWP populates with the correct data.  Everything works as advertised from then on.

    Is there any way of specifying that the first option from a data source should be selected in the dropdownlist control via SPD?

  153. S Scott says:

    Just to add to the debate above about getting at the value of a TextBox:

    Someone mentioned that using Location="Form(TextBox1)" won’t return anything. That’s because the Form value will be held under the name of the control after ASP.Net has rendered the Textbox into an Input tag. So you need to put in the name (not id) of the input tag. View the page source to find it.

    So you’ll end up with something like: Location="Form(ctl00$PlaceHolderMain$TextBox1)"

    Of course only use this on a page when you know this control is always going to get named consistently – i.e. the control is staying in the same place on a static page. But if you do move the textbox on the page then remember to check it’s new name & modify the parameter accordingly.

    I’ve found this to be the simplest way to get textbox working as filters.

  154. Benj says:


    Does anyone solved the problem of duplicated value in a drop down list populated by a SP list? As donna and Derson, Ned and Salil I have the same problem and nobody gave us a solution.

  155. Kurt says:


    Is it possible to filter a "data view" web part based on a "page filter" web part ?

    Let’s have this scenario:

    I have a list of countries and info about them (population etc)

    I have a list of users, and one of the fields is a lookup to country (single select).

    Now when opening the dispform.aspx for a user, I want to display the full info of the country for this user below the user details.

    I tried to do this with a page filter (on the country field of the user item) and a data view (of the countries list), but I don’t manage to link these two to display the country info.

    Anyone that can put me on the right track with this ?


  156. Sunil Yadav says:

    Nice post but can anyone provide the solution for duplicated values in teh Drop down.

  157. sun_sky4u says:

    Nice post. But any solution for duplicated values. Alreday I have specified DISTINCT in the datasource tag but no luck…

  158. Ombiro says:

    Concerning this answer, It does not work for me. Can someone give me a step by step wizard procedure for selecting a column based on another column. and in cases of having more than two drop down lists and the last drop down selection is based on the first two what do you do. This is as applied to SharePoint Designer 2007 and not from the server point of view. Filtering a dropdown based on the selection from the first dropdown (list of states based on choice of country):

    <asp:SqlDataSource…  SelectCommand="SELECT * FROM [States] where [Country] = @Country">


    <asp:controlparameter PropertyName="SelectedValue" Name="Country" ControlID="ddlCountry" />



    The above method does not work in sharePoint 2007.

  159. jenfi says:


    how can i filter my data view using a textbox, the user anter a value in the textbox and the dataview display all the data corresponding to the value

  160. Abhishek says:

    The demonstration was very help ful but I m trying it on content page. Its not happening!

  161. Select a single row of data from a list using SharePoint Designer says:

    Hi John,

    I need some miinor help getting the data I need from lists that I have developed.  I want to be able to select one row of data and then place the data on a page in a specific format I have set up.  How do I select that one piece of data?  I have seen many ways to select all of the data or the first row of the list but not a specific row.  I have an ID column I want to use as the key field to pic from.  Can you help with this?


  162. Maricela says:

    Do you know if there is a book or something else about How to use Asp .Net Controls in Sharepoint Desginer 2010?

    I need some help with the topic because I need to develop a web application using Asp .Net controls, exclusively..

  163. Doing the same in SPD 2010 says:

    Hi John,

    How do you do this in SPD 2010?  Thanks

  164. dheena says:

    nice post… I was searching this kind of  asolution for  along time. Now i can understand the power of SPD which is more helpful to build the app with out code…. 🙂

  165. van says:

    Hi -,

    I'm trying to figure out how to bind the data source to asp textbox insead of dropdown..

    Can you show me how?  Thanks in advance…. by the way .. I'll be glad if you could email me your reponse. my email address is


  166. rohith says:

    I follwed the steps but only  the value given in default value  is filtering…but values sent from dropdown isnt working.

Comments are closed.

Skip to main content