Microsoft Developer Network > Domovská stránka fór > SharePoint - Design and Customization > Passing parameters from a dataview via querystring
Odeslat dotazOdeslat dotaz
 

OdpovědětPassing parameters from a dataview via querystring

  • 3. července 2009 21:24prostration Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    I have a dataview that displays the items from a list. I inserted a column and added a hyperlink, from there I added whatever parameters I wanted to pass, this works great. Now how can I do this with a button instead of a hyperlink? I tried to do it by adding a button instead of a hyperlink to my new column and placing this code inside my button: document.location.href = ('http://something/something.aspx' + <xsl:value-of select="@whateverparameteriwanttopass"/>)

    However instead of getting the specific value for the parameter of the row where I click the button like it does with the hyperlink, it always gives me the value of the last item in the dataview. How can I fix this?

Odpovědi

  • 3. července 2009 21:56Mchova01 Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     Odpovědět

    Try replaing the code to create your button with the following:

    <INPUT TYPE="BUTTON" VALUE="Button Title" ONCLICK="window.location.href='http://something/something.aspx?ID={@ID}'"/>

    Replace "?ID=" with the name of your parameter, (e.g. "?Myparameter=")
    Replace {@ID} with the column name used for the parameter source (e.g. {whateverparameteriwanttopass})

    This worked on my end.

    • Označen jako odpověďprostration 3. července 2009 22:17
    •  

Všechny reakce