locked
ASP.NET event handler code do not get inserted inline when using VisualStudio 2010 isolated shell application RRS feed

  • Question

  • Hello,

    I have created a Visual Studio 2010 isolated Shell application. With that application I open the following start.aspx file:

    <%@ Page Language="C#" %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

     

    <script runat="server">

     

    </script>

     

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head id="Head1" runat="server">

           <title>title</title>

    </head>

    <body>

          

    </body>

    </html>

     

    Then I switch to WebForms designer view and drag&drop a standard ASP.NET Button web control ( <asp:Button ID="Button1" runat="server" /> ), wich displays nicely. Then in the designer view I double-click on the button and expect the event handler code getting inserted “in-line” within the <script>  page tag, but it does not.

     

    If I change the page language to <%@ Page Language="VB" %>  and reopen it in the editor, it behaves as expected  and when I doubleclick on the designer asp Button the event handler code gets inserted fine within the script tag:

     

    <script runat="server">

     

        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

     

        End Sub

    </script>

     

     

    Can somebody point out any explanation regarding why this works fine if I use VB but not if I use C#? 

    I wonder it could be a Visual Studio Shell webforms designer behaviour.  How can this be worked around?

     

    Thankyou in advance

    Wednesday, July 14, 2010 1:20 PM

All replies

  • Hello,

    Maybe you mistake Webform and html page, they are definitely two things. WebForm is the aspx file, which ran at server, it will be translated to html page before sending to client. See this link for their difference

    http://www.dotnetspider.com/forum/41359-Difference-between-HTML-Controls-WebForm-Controls.aspx

    And you should use Html here.

    <%@ Page Language="VB" %>   means the script language is VBScript, it does not mean VB.net. And you could also try <%@ Page Language="Javascript" %>  to indicate you use javescript language.

    Thanks

    Chao

    Friday, July 16, 2010 12:00 PM
  • Hello,

    Maybe you mistake Webform and html page, they are definitely two things. WebForm is the aspx file, which ran at server, it will be translated to html page before sending to client. See this link for their difference

    http://www.dotnetspider.com/forum/41359-Difference-between-HTML-Controls-WebForm-Controls.aspx

    And you should use Html here.

    <%@ Page Language="VB" %>   means the script language is VBScript, it does not mean VB.net. And you could also try <%@ Page Language="Javascript" %>  to indicate you use javescript language.

    Thanks

    Chao


    Thanks for you reply. Let me try to be more precise.

    We definitely intend to use WebForm controls running on the server, not HTML controls.

    Our project is aimed to produce a VisualStudio 2010 isolated shell application that helps users to create .aspx -like pages. I'm aware that no debugging nor language services are available on the isolated shell, but I'm confident that we will be able to use some design-time or editing capabilities. I guess it can be done thanks to the webforms designer that is included in the VS isolated shell runtime.

    So we open an .aspx file on our isolated shell application and then we can drag&drop one or more asp.net web controls on it. Take a <asp:Button ID="Button1" runat="server" /> for instance. 

    Please keep in mind that we expect the generated code will run on the server side:  <script runat="server">

    Everyting works flawlesly if the page directive is set to <%@ Page Language="VB" %>>  , we even have sintax coloring and autocomplete features! But it gets poorer if we switch to <%@ Page Language="C#" %>

    Is this a known Visual Studio Shell webforms designer limitation?  How can this be worked around?

    Thanks in advance

    Monday, July 26, 2010 2:39 PM
  • JCosta, how were you able to provide this support in Isolated Shell (ASPX, simple editing).
    Thursday, October 6, 2011 7:41 PM