Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andrei Yazik 24 posts 44 karma points
    Apr 04, 2011 @ 16:32
    Andrei Yazik
    0

    Getting macro in code-behind

    Hello everyone,

    I've created an XSLT macro to display the drop-down list, and use it on a master page. And now such a situation occured that I have to get the current selected value in a code-behind, but cannot access it. Could you please help me?

    Many thanks,

    Andrei

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 04, 2011 @ 18:57
    Jan Skovgaard
    0

    Hi Andrei

    Are you asking how to retrieve the value of the selected value from the dropdown generated in XSLT? If so...I don't think that it's possible to it like that.

    I think you need to use a user control to build the dropdown list and then you can easily grab the selected value in the C# code.

    Hope this help.

    /Jn

  • Craig Taylor 29 posts 69 karma points
    Apr 04, 2011 @ 20:18
    Craig Taylor
    0

    You could probably use jQuery/Javascript to get the selected value when a user changes the selected index and store it in a hidden variable that has "runat=server" on it.  Then, in the code-behind, grab the value of that hidden variable.  A bit more complex this way and I haven't tested it, but perhaps a solution if you don't want to re-write your XSLT as a user control.

    -Craig

  • Andrei Yazik 24 posts 44 karma points
    Apr 05, 2011 @ 14:29
    Andrei Yazik
    0

    Thank you very much, guys!

    I've chosen creating a user control. The issue is now solved

Please Sign in or register to post replies

Write your reply to:

Draft