Microsoft Developer Network > Forenhomepage > SharePoint - Design and Customization > Passing parameters from a dataview via querystring
Stellen Sie eine FrageStellen Sie eine Frage
 

BeantwortetPassing parameters from a dataview via querystring

  • Freitag, 3. Juli 2009 21:24prostration TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     
    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?

Antworten

  • Freitag, 3. Juli 2009 21:56Mchova01 TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Beantwortet

    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.

    • Als Antwort markiertprostration Freitag, 3. Juli 2009 22:17
    •  

Alle Antworten