locked
Databound Radio Button List - Set Default Value RRS feed

  • Question

  • Hello,

     

    I have a data view web part on a page in a SharePoint 2007 Enterprise MOSS Site with publishing switched on.

    I am currently filtering the DVWP by a set of radio button options based on locations:

     

    ·     All

    ·     Location 1

    ·     Location 2

    ·     Location 3

     

    The radio buttons are data bound to a data source (this is a list within SharePoint) that contains my location information.

     

    What I want to do is set the 'All' option as the default option so that it is automatically selected when users enter the page.  I can do this if the radio buttons are configured directly on the page, but this option is no good if I want to make it easy for end users to extend the amount of filter options available on this page without having to open SharePoint Designer.

     

    Has anyone done this before and can you help me?

     

    Thursday, November 17, 2011 10:17 AM

Answers

  • Hi EmmaCat,

    I have a test in my local server, you can follow the steps below to check whether it meets your requirements

    1.       New an ASPX page with a data view web part, add a radio button list control.

    2.       In the Data Source Library, choose the data source list you would like to make it the radio button list control data source, click Insert data source control.

    3.       Choose the radio button list, in the Common RadioButtonList Tasks, click Choose datasource, then you can configure the radio button list datasource.

    4.       In the Common RadioButtonList Tasks, click Edit Items, in the opening dialog, edit the Text and Value with “All” to add a value to the control, the value will be default value of the control.

    5.       In the data view web part parameters, add parameters, choose the parameter source: control, control Id: the datasource control Id

    6.       In the data view web part filter, check Add XSLT Filtering, click Edit, type the XPath expression like: [(@Location=$param1) or ($param1=”All”)]

    Then the page will show all items when loading.

    Thanks,
    Qiao

    • Marked as answer by Emir Liu Friday, November 25, 2011 4:13 PM
    Tuesday, November 22, 2011 11:22 AM
    Moderator