Ajax Facebook Like & Sharethis Postback Problem - c#

I am having problems displaying both Facebook Like and Sharethis widgets to show up on postback event, initial load displays them perfectly, but as soon as page invokes partial postback and since both widgets are wrapped in update pannel, the elements disappear from the page.
Note: I tried the iframe solution for the facebook like button, which is now giving me another problem with not being able to reach the page, even though with current method outside of the update panel it's working correctly.
any help would be appreciated.

Related

Browser back button with update panels

In an asp.net/c# application, I have an update panel on my main page. And everything on the page is updated via the update panel.
So there is only one page and all the changes are made in update panels using asynchronous postback (partial postback)
My question is: Is there a way to make the browser BACK button works and return the page to it's previous state?
Hope I was clear
Thank you very much for any help
more info: I tried to implement this http://rchern.wordpress.com/2008/05/11/updatepanel-backforward-browser-navigation/ but I wasn't able to make it work.
This is often a problem you could look at the resources mentioned in the answer to this question:
How to save history within UpdatePanel?

facebox in asp.net cannot postback

i have an aspx page with feedback form which rendered inside facebox. In the form, i have a button which used to submit the form. After this, the facebox closes and its opening the page which is loading in the facebox in another page. I did go through many q&a here and tried on many suggested answers such as the link attached as below but unfortunately I still cannot figure it out.
http://weblogs.asp.net/kariemsoudy/archive/2009/11/02/buttons-inside-facebox-popup-don-t-postback-fix.aspx
Facebox adding commas to input
Appreciate for any reply. thanks in advance.
You might want to try sticking your app in an UpdatePanel so that when you postback in your section it's not posting back the entire site to FaceBook. I'm not sure how your site is embedded into facebook, but if possible you might also try using iFrames to do the same thing (so that you're only posting back your frame, and not the entire facebook page). My guess is that the postback to facebook results in your page being overwritten (by facebook).
If you are having issues with posting back, the easiest way to force the postback is to trigger the __doPostBack method as in:
__doPostBack('uniqueid', 'args');
Regardless of the issue with the button click, this should do the job.

Webforms Refresh problem

This is probably a simple question for every WebForms developer but I am knew to this scene. I have a page that has an "ADD" button on it that results in a jquery popup where the user can submit a form that will add an entry to the repeater on the page. My problem is that after the user adds an item, if they then hit the refresh button the item will get added again. I can't stop this with the page.ispostback because that would block the original add. What can I do here?
that's a common problem. Here's explanation and solution of the problem.
When a web form is submitted to a server through an HTTP POST request, a web user that attempts to refresh the server response in certain user agents can cause the contents of the original HTTP POST request to be resubmitted, possibly causing undesired results, such as a duplicate web purchase.
To avoid this problem, many web developers use the PRG(Post/Redirect/Get) pattern.
copied from wiki (LINK)
simplest solution can be Response.Redirect to the same page (i.e. if you page is named default.aspx write Response.Redirect("default.aspx")). if you do this browser refresh button will just load the page as if you have typed in address bar URL and navigated to it.
here's SO question How to stop unwanted postback that might be useful as well.
If there is an option to delete an item on the page (is there?), do you really have to be concerned with that happening? May want to think about that. Just a thought.

Change the url in browser from c# codebehind (NOT seo routing or URL rewriting)

I have a website where there is a lengthy list of items to display so I am using Pagination to make the load on server easier.
However, I am doing the pagination via Ajax so when the user clicks on Next Page or Previous Page linkbutton, the data repeater is refreshed with ajax.
This was working fine until, people started to click on the item and then click back, it takes them to the first page.
suppose you scan about 10 pages, by clicking on the "Next Page" button. The data changes, but the URL in the browser doesnt. And you think you found what you want so you click on it, the browser loads different page, and when you click back, the browser takes you to previous page but since the url did not change, you are back to page 1.
Currently, I have removed ajax so the url changes everytime, but I have seen several website re-write the url in browser when ajax even happens, and I was wondering if I could do the same.
Google search for url re-write digs up only seo routing stuff, nothing on what I actually want (i am sure i am not using the right words)
I was interested to know this problem, any clues or leads on this one?
thanks!
ps: several questions here were kind of close, but was either too complicated or too deviated. sorry if its a duplicate.
The only part of an URL that you can change in js, client-side, without forcing browser to reload whole page is an anchor part (http://domain/page#anchor - the part after # sign). This part is used by many js application (e.g. Google Picassa), also by silverlight to provide browser history support. You'd have to set an anchor part when navigating to another page of your data. When the page is loaded, just check the anchor part and load appropriate page. Also, you'd have to periodically check for changes - this will happen when user uses back/forward feature in his/her browser. (There could be an event that is fired when that happens, I just haven't found it)

full postbacks with ASP.Net AJAX on an ASP.NET page within an IFRAME

I have an ASP.Net page that is contained within an iframe the page has an update panel, that, in isolation, works however when the page is within the iframe, the update panel always produces a full postback. I guess that the problem is the iframe itself but id like to know
a) why it doesnt work
b) if there is a solution beyond rolling my own controls and writing a whole load of js
EDIT
ok its ASP.Net 2.0 and the 1.0 toolkit the page broadly looks like this (Note for the pedants i haven't closed tags, this is just to show the basic structure)
Main Page
Form
table
td
iFrame
! -- contained page --
Form
asp:ScriptManager
asp:UpdatePanel
asp:Repeater
I have been using some of my pages in IFrames using UpdatePanel, and they DO NOT produce any full page postbacks.
Can you describe the whole setup in more detail?
EDIT: Hmmm. The setup looks OK. Did you check whether the control which triggers the postback is placed inside the panel? Also, did you check for JS errors occuring before the ajax request fires?
Today I came across the same problem (trying to load gridviews asynchronously): A postback inside an iframe would reload the whole page, and ignore the postback event handler.
My solution was to use UFRAME.

Categories

Resources