How to auto update page when drop down changed in xslt
Hello,
I have a products page on my site that lists out all the products (either all or the results of a search) that I would like to be sortable based on a customer selection in a drop down box.
I have the drop down all set up, and I should be able to work out which option was chosen, but I can't work out how to auto update the page. I don't want the user to have to press another button when the selection is made.
I've put the drop down in the xslt instead of a .net user control, because I already have xslt listing out all the products, so would be a bit difficult now to have it a different way.
If anyone has any ideas I would be extremely grateful.
So this is actually a front end problem that I guess you've normally had a .NET usercontrol magically solve for you, right (?).
XSLT just helps you generate the HTML you send to the browser - once there it's up to the behaviors you've built into the code to handle updates etc. ASP.NET controls generate a lot of JavaScript too that handles all this updating stuff.
I've always built my stuff so that it works for non-js mode, so I can pick an option and hit return to post the form. I may even add an "Update" button which I can later hide if I want to. Then I add the auto-posting with an onchange event on the <select> (all done from within a separate JavaScript file). This way I know it works as it should (and if I use GET in the form method, I can even permalink to a specific selected option in the form). Sometimes I'll add a second behavior to use Ajax to load the result of posting the form and then parse it, to inject the result back into the page (which is what some .NET controls actially do - with 10x the JavaScript :-)
So do you know how to do the HTML and JavaScript for this to work? Or do you need help with more than just the XSLT?
Also, please don't hesitate to tell me if I've completely missed the point of your question :-)
You've understood it perfectly, and offered a good suggestion. Yes I should be able to do it with Javascript (i think!) but may have to break out my old text book!
How to auto update page when drop down changed in xslt
Hello,
I have a products page on my site that lists out all the products (either all or the results of a search) that I would like to be sortable based on a customer selection in a drop down box.
I have the drop down all set up, and I should be able to work out which option was chosen, but I can't work out how to auto update the page. I don't want the user to have to press another button when the selection is made.
I've put the drop down in the xslt instead of a .net user control, because I already have xslt listing out all the products, so would be a bit difficult now to have it a different way.
If anyone has any ideas I would be extremely grateful.
Thanks
Hi John,
So this is actually a front end problem that I guess you've normally had a .NET usercontrol magically solve for you, right (?).
XSLT just helps you generate the HTML you send to the browser - once there it's up to the behaviors you've built into the code to handle updates etc. ASP.NET controls generate a lot of JavaScript too that handles all this updating stuff.
I've always built my stuff so that it works for non-js mode, so I can pick an option and hit return to post the form. I may even add an "Update" button which I can later hide if I want to. Then I add the auto-posting with an onchange event on the <select> (all done from within a separate JavaScript file). This way I know it works as it should (and if I use GET in the form method, I can even permalink to a specific selected option in the form). Sometimes I'll add a second behavior to use Ajax to load the result of posting the form and then parse it, to inject the result back into the page (which is what some .NET controls actially do - with 10x the JavaScript :-)
So do you know how to do the HTML and JavaScript for this to work? Or do you need help with more than just the XSLT?
Also, please don't hesitate to tell me if I've completely missed the point of your question :-)
/Chriztian
Hi Chriztian,
Thanks for your reply.
You've understood it perfectly, and offered a good suggestion. Yes I should be able to do it with Javascript (i think!) but may have to break out my old text book!
Thanks for your help, it is much appreciated.
John.
is working on a reply...