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?
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.
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.
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
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
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
Thank you very much, guys!
I've chosen creating a user control. The issue is now solved
is working on a reply...