Hi!
I'm using metronic v8 theme in my asp.net project (not mvc).
Generally js compenents stop working after postback on asp.net but i solve this calling them again after postback and they works. but on sticky divs doesn't work. I think I couldn't call them right way.
For example select2 dropdowns stop working after postback. and i call them like this and they works all time;
ScriptManager.RegisterStartupScript(this, GetType(), "x", "<script type = "text/javascript">$("#DrpPaymentTypes").select2();</script>", false);
ScriptManager.RegisterStartupScript(this, GetType(), "x", "<script type = "text/javascript">$("#TxtInstallmentDate").flatpickr({format: "DD/MM/YYYY",minDate: "today",enableTime: false,parseDate: (datestr, format) => {return moment(datestr, format, true).toDate();}});</script>", false);
ScriptManager.RegisterStartupScript(this, GetType(), "x", "<script type = "text/javascript">var stickyElement = document.querySelector("#invoice");
var sticky = new KTSticky(stickyElement);</script>", false);
ScriptManager.RegisterStartupScript(this, GetType(), "x", "<script type = "text/javascript">KTSticky.init();</script>", false);
I tried but doesn't work.
Hi,
The initialization of KTComponents.init(); should trigger global KTSticky initialization. Please make sure that the initialization function has been triggered.
For more information about the KTSticky component, you can refer to <a href='https://preview.keenthemes.com/html/metronic/docs/general/sticky'>our KTSticky documentation</a>.
Regards,
Lauris Stepanovs,
Keenthemes Support Team
Hi,
Can you please try to call the global component init function after postback as explained here:
KTComponents.init();