Putting a FBML user control via AJAX

Oct 26, 2009 at 7:50 AM

Hi there

In my project (Iframe Canvas) I have a page with a Menu and an UpdatePanel. For each choice the user is doing on the menu, I want to change the User Control that is in the UpdatePanel.

Now, so far none of it required any special FBML, so it worked out fine, but a couple of days ago I started working on the "invite friends" User Control.

As you know, invites and requests require FBML, and it doesn't matter what I do, that User Control just don't get shown.

Help please?

 

My "master" page:

http://pastebin.com/f6f34d8f6

the code behind:

http://pastebin.com/f3d3c7746

the InviteBox UserControl:

http://pastebin.com/f187e6764

and finally, the Ivitebox code behind:

http://pastebin.com/f6d45dda8

 

Oct 26, 2009 at 3:49 PM

You have FeatureLoader.js.php loading, but I don't see the other stuff required to get it to work so it will actually process your fb:serverfbml tag.  I think you also need an xd_receiver.htm file and some javascript to get things initialized.  

See steps 2 and 5 on this page:  http://wiki.developers.facebook.com/index.php/XFBML

Oct 26, 2009 at 4:53 PM

I have an xd_receiver.htm file, and the javascript for the FB_RequireFeatures and the FB.Facebook.init and in the JScript.js file. However, I do not know how to make that function run after the Load event of the InviteBox.

Any assistance would be very appreciated

 

Oct 26, 2009 at 9:35 PM

so is it a problem with the order in which the various javascript bits get loaded to the DOM (script in masterpage, script in page/user control, script injected via usercontrol page_load event)?

Have you tried for debugging just making a page with all of the javascript right on the page, not in the masterpage or injected via the code behind, just to be sure all the Facebook stuff works before trying to generate and inject the javascript from the page code behind?

Or what about an alternate approach where you try to go more client-side and use the page_load event just to put your variables into hidden elements and access them all via javascript to generate your xfbml, or via inline code <%= variable %> outside of the code-behind?

Just some ideas.  It seems the issue is the sequence in which the different script bits are landing on the page.

Oct 27, 2009 at 1:10 AM
I don't think I undestand what you mean, can you please be a little more specific?

2009/10/26 patja <notifications@codeplex.com>

From: patja

so is it a problem with the order in which the various javascript bits get loaded to the DOM (script in masterpage, script in page/user control, script injected via usercontrol page_load event)?

Have you tried for debugging just making a page with all of the javascript right on the page, not in the masterpage or injected via the code behind, just to be sure all the Facebook stuff works before trying to generate and inject the javascript from the page code behind?

Or what about an alternate approach where you try to go more client-side and use the page_load event just to put your variables into hidden elements and access them all via javascript to generate your xfbml, or via inline code <%= variable %> outside of the code-behind?

Just some ideas.  It seems the issue is the sequence in which the different script bits are landing on the page.

Read the full discussion online.

To add a post to this discussion, reply to this email (FacebookToolkit@discussions.codeplex.com)

To start a new discussion for this project, email FacebookToolkit@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Oct 27, 2009 at 8:06 AM

So...umm, I tried some things, and none of them worked.

it would seem that the biggest problem I have is that I don't seem to be able to make the javascript run, from some bizzare reason, which I do not understand.

I have tries to implement the Javascript directly in the usercontrol. doesn't work.

I tried several ways of doing it via the codebehind:

http://pastebin.com/f1596f31

and still I got nothing.

it looks to me as if I'm missing something stupid...something that will allow the javascript to run from the User Control at all.

any thoughts?

Oct 27, 2009 at 2:21 PM

I don't do a lot with the scriptmanager and code behind javascript injection.  I suggest you do some google searches within the Stackoverflow.com site for things like "user control registerstartupscript site:stackoverflow.com" and if you can't find an answer, post your code and a question.

Nov 28, 2009 at 7:46 AM

Have you ever solved this issue? I am having a very similar problem