Annoyances with CanvasFbmlBasePage in VS2005

Sep 28, 2007 at 9:05 PM
Edited Sep 28, 2007 at 9:07 PM
I am getting things done with the CanvasFbmlBasePage in VS2005 but I am getting irritated about the visual studio errors notifications I am getting:

1. In the aspx page,
<form id="form1" runat="server" >
<asp:label id="Label1" runat="server">Label</asp:label>
<fb:if-user-has-added-app><fb:share-button class="url" href="someurl"/>
<fb:else>
click here to add
</fb:if-user-has-added-app>
</form>

Those identifiers are underlined as shown and sometimes, but I don't think always, VS lists those issues in the error list:
Unrecognized tag prefix or device filter 'asp'
Unrecognized namespace 'fb'.

2. Another issue in the error list for the aspx page:
Element 'html' occurs too few times
Element 'form' must be included within a parent element.
Obviously, those elements would like to be nested inside body and html tags, which would break the page when served as fbml to facebook. The errors don't prevent compiling, but make it difficult to see errors that are fatal.

3. In the (VB) code behind pages, things get even more mysterious:
completely random errors because the code is looking (and compiles) fine:
Statement cannot appear within a method body. End of method assumed.
'End Sub' must be preceded by a matching 'Sub'.
'End Class' must be preceded by a matching 'Class'.

4. The code behind pages most often (but not always) ignore some of the References that I had set in my application, so that I have to declare those objects with the complete namespace, like this:
Dim rdrGetTexts As Data.SqlClient.SqlDataReader
instead of
Dim rdrGetTexts As SqlDataReader
I have tried remove and re-add the reference to the data namespace, but didn't help.

This line here
Dim cmdGetID As SqlCommand
compiles, but then I get
Type 'SqlCommand' is not defined.
as the error when executing the page.

Only 4. (sometimes) prevents compilation, or if compilation does work, can lead to failure on execution. (Others have reported this problem, as well.) Common to all these issues is, however, that programming with VS gets much less comfortable and it gets harder to see errors that do need to get fixed.

Some info about my system which could be related to these issues:
I am creating my fb app as part of my existing webapplication, with all other pages inheriting System.Web.UI.Page. Those pages don't have any of the problems described, and that's why I am posting it here.
This also means that I am not using the web.config file that came with the Sample Application - perhaps that's relevant?

5. Another question out of curiosity:
When adding controls to pages that inherit CanvasFbmlBasePage, those controls are automatically declared, but not visibly in the code behind file as known from vs2003 but more like they would have been declared in VS2005 with the new programming model. I, however, set my VS2005 to keep the behavior of VS2003, so on all other pages I need to manually declare controls in the code behind files after adding them to an aspx page.

Wow, what a long post, but I don't think I can live with these issues any longer since I am sure there must a simple solution to it. Or am I the only one with this set of issues? In any case, thank for reading this!
Nov 27, 2007 at 2:51 AM
Hi, I am really suprised you never got a reply. I am suffering from the same problem and starting to tear my hair out!

You say your program still compiles, mine does not, all I get are errors.

I get:

'unrecognised namespace fb' &
'element HTML occurs too few times'

I have added both facebook.dll and facebook.webcontrols.dll

Why won't my .aspx page accept 'fbml'??

Any help, greatly appreciated.

thanks
David.
Nov 27, 2007 at 4:56 AM
Hi David,
Sorry to hear about your trouble - vs not even compiling makes it truly bad. However, I have nothing to add to my ancient post - the same issues still exist and I have not learned anything else. I don't know why vs compiles for me but not for you. I guess you have all the declarations right in you code behind page?

Imports System.Collections.ObjectModel
Imports Facebook
Imports Facebook.WebControls

Partial Public Class _Defaultfb
Inherits CanvasFBMLBasePage
....

Good luck!
Nov 28, 2007 at 2:40 AM

Hi,

Well, now it runs, thanks! But none of the <fb: tags are being recognised????

For example, I'm using the following code and only the standard HTML selection drop down is shown, the <fb: tags are ignored?? I have set my app up in Facebook with 'use FBML' under the Canvas Page URL, so you'd think it would work!?

again, any help appreciated.

David.

<fb:editor action="?do-it" labelwidth="100">
<fb:editor-text label="Title" name="title" value=""/>
<fb:editor-text label="Author" name="author" value=""/>
<fb:editor-custom label="Status">--%>
<select name="state">
<option value="0" selected>have read</option>
<option value="1">am reading</option>
<option value="2">want to read</option>
</select>
</fb:editor-custom>
<fb:editor-textarea label="Comment" name="comment"/>
<fb:editor-buttonset>
<fb:editor-button value="Add"/>
<fb:editor-button value="Recommend"/>
<fb:editor-cancel />
</fb:editor-buttonset>
</fb:editor>
Coordinator
Nov 28, 2007 at 4:25 AM
One of our collegues just added fbml intellisense support for visual studio (in Version 1.5). I will try to get some details and post about it.
Nov 28, 2007 at 9:52 PM

Great, thanks, look forward to it.

David.
Dec 6, 2007 at 5:45 AM
hi, how do i actually set up fbml intellisense support for vs2005?