Ask a questionAsk a question
 

AnswerDVWP Dropdown Default Value

  • Friday, November 06, 2009 5:06 PMillegal_operation Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
    On my newpage.aspx 
    I wanted to change the order of one of my dropdowns for my columns.  
    So I created a SPdatasource,  inserted it into my page.  Then added a DVWP displayed as a dropdown.

    This all works fine,  it inserts into the list but here the problem.   I would like to have the dropdown default to one of the values when the page opens.   Right now it shows as a blank option.   

    I don't see anything in the properties of the dropdown a way to do this,  is this possible?
    Thanks

Answers

  • Friday, November 06, 2009 8:16 PMloya Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi illegal operation,

    you have to look into "option" property, and set "selected" property. In html code, it would be like:

    <select>
    <option value="v" name="n" selected="selected">


    In xslt when data is dynamically binding, you could use <xsl:attribute> to attach an attribute such as:

    <option value="*">
       <xsl:attribute name="selected">
          <xsl:value-of select="selected"/>
       </xsl:attribute>
    </option>

All Replies

  • Friday, November 06, 2009 8:16 PMloya Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi illegal operation,

    you have to look into "option" property, and set "selected" property. In html code, it would be like:

    <select>
    <option value="v" name="n" selected="selected">


    In xslt when data is dynamically binding, you could use <xsl:attribute> to attach an attribute such as:

    <option value="*">
       <xsl:attribute name="selected">
          <xsl:value-of select="selected"/>
       </xsl:attribute>
    </option>