Web part lost when page post back - sharepoint-2010

Here is the brief detail of issue.
I have Page1 where I have put LinkButton. The LinkButton Has property PostBackUrl pointing to Page2.
When user is redirected to page2, I am using Page Load method to access controls from previous page & get the needed value. To make clear, I am using this approach becuase I cant use querystring.
Page 2 has 2 web parts on it. The web parts use data received in Page Load event from page1 and renders data.
This works perfect on first page load. When user clicks on a URL in page which posts back, the web parts gets lost.
Note that if I come directly to page2 without going at page1, then web parts are retained in the page and they are not lost.
Can anyone give me the clue of issue cause?
Thanks in advance.

Do you have any debugging enabled? you are most likely looking for values on page load that don't exist and might be getting exceptions that aren't handled properly.

I am not sure why but somehow code was throwing an exception when I tried to access the property Page.PreviousPage. Though I had made sure to check null on each step. Even code was never get hit when web part was lost. So it is still a mystery for me.
Just in case someone comes across this issue my workaround may help. I used Post back to page2 using post method. I accessed the variables using Page.Form[] variables. This way my issue of getting web parts lost got resolved.

Related

HTMX sometimes redirects to a page fragment instead of placing it in the page

I'm using HTMX to replace a fragment of page every 30 seconds using the following code:
<ul hx-get="/refresh" hx-trigger="every 30s" id="today" hx-select="#today" hx-target="#today" hx-swap="outerHTML">
This works perfectly most of the time. However when I leave the page open I sometimes come back and find it has redirected to the hx-get url ("/refresh" in the example). So it's showing just the unstyled fragment and the url bar shows the fragment url.
I think this might be something to do with the behaviour that is intended to show errors when they occur, but the page shown isn't an error. I think was happened is that HTMX got a transient error (maybe a drop in my internet connection when my laptop went to sleep) then just redirected to the page to show it but by the time it loaded the error was gone.
Any way to fix this? Assuming my assumption above is correct I think I'd like to silently drop errors for this particular element rather than redirecting to them.
Thanks in advance!

(Karate) How to intercept the XHR request response code?

I am testing a login functionality on a 3rd party website. I have this url example.com/login . When I copy and paste this into the browser (chrome), page sometimes load, but sometime does not (empty blank white page).
The problem is that I have to run a script on this page to click one of the elements (all the elements are embedded inside #shadow-root). If the page loads, no problem, script is evaluated successfully. But page sometimes does not load and it returns a 404 in response to an XHR request, and as a result, my * eval(scrip("script") step returns "js eval failed...".
So I found the solution to refresh the page, and to do that, I am considering to capture the xhr request response. If the status code is 404, then refresh the page. If not, continue with the following steps.
Now, I think this may work, but I do not know how to implement karate's Intercepting HTTP Requests. And firstly, is that something doable?
I have looked into documentation here, but could not understand the examples.
https://github.com/karatelabs/karate/tree/master/karate-netty
Meanwhile, if there is another way of refreshing the page conditionally, I will be more than happy to hear about it. Thanks anyone in advance.
First, using JavaScript you should be able to handle shadow roots: https://stackoverflow.com/a/60618233/143475
And the above answer links to advanced examples of executing JS in the context of the current page. I suggest you do some research into that, try to take the help of someone who knows JS, the DOM and HTML well - and you should be find a way to know if the XHR has been made successfully or not - for e.g. based on whether some element on the page has changed etc.
Finally here is how you can do interception: https://stackoverflow.com/a/61372471/143475

Animated blocks in AOS and NUXT JS tends to disappear whenever the page reloads

I'm working on a project and using AOS animation but all div blocks that have an animation on them disappear whenever I refresh the page. I want to trigger a function whenever the page is refreshed so I can use the AOS.refresh(). Is there any way to do this in nuxt.js or maybe a way to go around this AOS bug?
UPDATE:
here's an example this is how the page looks before reloading:
then after reloading:
As you can see. the elements that still appear after the reloading are the ones without AOS animation.
Additionally, if you focus your eyes on the sidebar, notice I have a home page. this problem happens literally everywhere except the home page. When I go to the home page then I go back to other pages the problem basically disappears.
Not sure where is your bug coming from but so far, the homepage of the library achieves to have an animation on a page refresh. Maybe it is a lifecycle code issue at some point. Maybe post some for us to help you debug this one.
To my knowledge, there is no way of watching if your webpage is actually refreshed because there is nothing related to state before this. The only somehow useful thing that may be used sometime is this.$router.history._startLocation, which will give you the first path your webapp was loaded on.
Not sure if it may help you anyhow.
Also, you can maybe give a shot to this library in VueJS and wire it to Nuxt. Should behave pretty much the same.

How can I clear the PropertyModel's value when I hit back on my browser

I have a DropDownChoice with a PropertyModel in my page and I have some other actions which take me to different pages. Now when I click on the Back Arrow on my browser, I come to my page which has the DropDownChoice with the previously selected choice. I understand PropertyModel holds the value for me. But how can I get rid of it when I hit Back button and why is the onBeforeRender(both on the class as well the Component) not working when I hit the Back button. Please comment if my explanation is not clear enough. I am using Wicket 1.4.8
onBeforeRender doesn't work because it's never called. When you navigating using "Back" button, no new request are sended to your server, hence page rendering never occurs. The only way to solve your problem - is to use javascript.

Wiki Page Library issue in SharePoint 2010

I would really appreciate it if someone would help me out with this issue.
I'm using SharePoint 2010. I created a Wiki Page Library without changing any of the library settings, and created a new Wiki page, all that went fine but once I started adding text and then tried to save the changes on the page, this message appears:
"You must specify a value for this required field"
I don't know what to do, there is no required field and I can't really fix that... so please help me with that message!!
Fatima, I don't know if you ever got your question answered, but this is a known issue with Publishing features. There is a field that is marked as required, but is not displayed on the page. I beleive it's the column/field called "Name". If you look through the Site Content Types and find "wiki page", you'll see that status is marked as "Required". Changing that should fix the issue for you.
This was caused by a Place holder missing from the Main area of your master page.
Even if you’ve moved it to a asp:Panel and declared it as false at the bottom of your master page you’ll still get the error.
All you need is to move content place holder
<asp:ContentPlaceHolder id=“PlaceHolderPageTitleInTitleArea” runat=”server”></asp:ContentPlaceHolder>
within the s4-bodyContainer div , within the s4-ca div seems to work best. Save the master page and that’s it. that no more irritating message.
Reference: http://sharepointbrandingteam.wordpress.com/2012/05/25/sharepoint-2010-error-you-must-specify-a-value-for-this-required-field/
Alternatively, you can try the solution suggested here