Creating a web form in VB.NET 2003

I apologise if this has been asked a thousand times.  Firstly, I am using VB.NET 2003 (v7.1.3088) and .NET Framework 1.1.4322  SP1 on WinXP Professional SP2 platform with all security and critical updates in place.

My background: good old FoxPro, VB6 and VBA under Access (yuk!)

I am playing about with a test project before hopefully upgrading to VB.NET 2005 and i am having a fundamental problem with web forms for a ASP.NET web application.  Whenever I copy and paste an object (text box, label, etc) VB.NET pastes the object back onto the form apparently correctly.  After updating the Text and Name properties I compile the solution and access the web-site using either IE6 or Firefox (v2.003).

All seems fine until i access the actual web form that i have updated.  I get various errors, the upshot is that VB.NET seems incapable of creating the underlying HTML correctly.  It either adds <DIV> ... </DIV> commands or adds the new object after the </DIV> or </FORM> tags.  Both of which cause errors.

This to me is making me think that web forms are a complete load of rubbish and I should go down the old Windows Application route.  I am only considering a web application for disaster recovery reasons.

The <DIV>s seem to have been added when I copied and pasted several objects from one web form to another.

I am missing something obvious or is really VB.NET this bad at creating its own HTML code for ASP.NET web applications?  I do not want to have to start editing HTML code just to get the application to work - after all isn't this why we have a GUI in the first place?  This is aside from adding an unknown quantity of time to my already short development plan.

Any ideas or help would be appreciated?

Thanks. 

Marcus.

0
mgpa
5/2/2007 2:05:15 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

4 Replies
955 Views

Similar Articles

[PageSpeed] 17

Hi,

That's a very strange error - I haven't seen anything like that before.  Is it adding <DIV>s to the .aspx page? or to the generated HTML?

Whatever the answer, that behaviour is strange, and I'd consider performing a repair on the VS.Net 2003 installation before spending too long on the problem.


 

0
Mr
5/2/2007 3:14:52 PM

Thanks for your comments.

Anything at the moment is welcome.  I will try a repair now.

There appears to a <DIV> object on the ASPX designer form as well as in the HTML associated with the ASPX file.  It does not seem possible to click on the <DIV> object and then pasting a previously copied hypertext link object into/onto it so that the pasted object is associated with the <DIV> object.  Pasting the object onto the form generates the error.  Is this where I am going wrong?

The following HTML code which contains some sample HTML with a graphic and a web hypertext links and is used to demonstrate my problem:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="MainMenu.aspx.vb" Inherits="Database.MainMenu"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <HEAD>
        <title>Main Menu</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body bgColor="white" MS_POSITIONING="GridLayout">
        <DIV style="Z-INDEX: 100; LEFT: 8px; WIDTH: 300px; POSITION: absolute; TOP: 8px; HEIGHT: 10px"
            ms_positioning="text2D">
            <form id="Form1" method="post" runat="server">
                <IMG style="Z-INDEX: 100; LEFT: 40px; WIDTH: 700px; POSITION: absolute; TOP: 0px; HEIGHT: 88px"
                    height="88" src="Logo%20Small.gif" width="700" align="textTop">&nbsp;</form>
        </DIV>
        <asp:HyperLink id="HyperLink1" style="Z-INDEX: 107; LEFT: 24px; POSITION: absolute; TOP: 336px"
            accessKey="i" runat="server" Width="152px" Height="32px" Font-Names="Verdana" NavigateUrl="Source Information.aspx">Source Information</asp:HyperLink>
        <asp:HyperLink id="hySourceInfo" style="Z-INDEX: 106; LEFT: 24px; POSITION: absolute; TOP: 288px"
            accessKey="i" runat="server" Width="152px" Height="32px" Font-Names="Verdana" NavigateUrl="Source Information.aspx">Source Information</asp:HyperLink>
        <asp:HyperLink id="hyCompanyDetails" style="Z-INDEX: 104; LEFT: 24px; POSITION: absolute; TOP: 248px"
            accessKey="c" runat="server" Width="152px" Height="32px" Font-Names="Verdana" NavigateUrl="Company Details.aspx">Company Details</asp:HyperLink>
        <asp:HyperLink id="hySettleCase" style="Z-INDEX: 103; LEFT: 24px; POSITION: absolute; TOP: 208px"
            accessKey="s" runat="server" Width="152px" Height="32px" Font-Names="Verdana">Settle Case</asp:HyperLink>
        <asp:HyperLink id="hyViewCase" style="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 168px"
            accessKey="v" runat="server" Width="152px" Height="32px" Font-Names="Verdana">View Case</asp:HyperLink>
        <asp:HyperLink id="hyNewCase" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 128px"
            accessKey="n" runat="server" Width="152px" Height="32px" Font-Names="Verdana" NavigateUrl="AddNewCase.aspx">New Case</asp:HyperLink>
    </body>
</HTML>

This web form was simply created by using the "Project", "Add Web Form ..." entering a name for it (in this case "MainMenu") and copying and pasting the graphic and hypertext links from another web form.

I then copy the "Reports" hypertext link and paste it and edit the object to create "Logout" hypertext link in the form designer.  The resultant HTML code is:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="MainMenu.aspx.vb" Inherits="Database.MainMenu"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <HEAD>
        <title>Main Menu</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body bgColor="white" MS_POSITIONING="GridLayout">
        <DIV style="Z-INDEX: 101; LEFT: 8px; WIDTH: 300px; POSITION: absolute; TOP: 8px; HEIGHT: 10px"
            ms_positioning="text2D">
            <form id="Form1" method="post" runat="server">
                <IMG style="Z-INDEX: 100; LEFT: 40px; WIDTH: 700px; POSITION: absolute; TOP: 0px; HEIGHT: 88px"
                    height="88" src="Logo%20Small.gif" width="700" align="textTop">
                <asp:HyperLink id="hyReports" style="Z-INDEX: 107; LEFT: 24px; POSITION: absolute; TOP: 328px"
                    accessKey="r" runat="server" Width="152px" Height="32px" Font-Names="Verdana">Reports</asp:HyperLink>
                <asp:HyperLink id="hySourceInfo" style="Z-INDEX: 106; LEFT: 24px; POSITION: absolute; TOP: 288px"
                    accessKey="i" runat="server" Width="176px" Height="32px" Font-Names="Verdana" NavigateUrl="Source Information.aspx">Source Information</asp:HyperLink>
                <asp:HyperLink id="hyCompanyDetails" style="Z-INDEX: 104; LEFT: 24px; POSITION: absolute; TOP: 248px"
                    accessKey="c" runat="server" Width="152px" Height="32px" Font-Names="Verdana" NavigateUrl="Company Details.aspx">Company Details</asp:HyperLink>
                <asp:HyperLink id="hySettleCase" style="Z-INDEX: 103; LEFT: 24px; POSITION: absolute; TOP: 208px"
                    accessKey="s" runat="server" Width="152px" Height="32px" Font-Names="Verdana">Settle Case</asp:HyperLink>
                <asp:HyperLink id="hyViewCase" style="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 168px"
                    accessKey="v" runat="server" Width="152px" Height="32px" Font-Names="Verdana">View Case</asp:HyperLink>
                <asp:HyperLink id="hyNewCase" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 128px"
                    accessKey="n" runat="server" Width="152px" Height="32px" Font-Names="Verdana" NavigateUrl="AddNewCase.aspx">New Case</asp:HyperLink>
            </form>
        </DIV>
        <asp:HyperLink id="hyLogout" style="Z-INDEX: 102; LEFT: 32px; POSITION: absolute; TOP: 376px" accessKey="l"
            runat="server" Width="152px" Height="32px" Font-Names="Verdana" NavigateUrl="Welcome.aspx">Logout</asp:HyperLink>
    </body>
</HTML>

Whilst my example shows a problem with hypertext links I have also experienced the problem with link buttons too.

It appears that the form designer has problems with the pasting of any object onto a form and specifically in the maintenance of the location of
"</form>" in ASPX's associated HTML code (though the above example does not demonstrate this).

I apologise for dumping my HTML code here, but I do not have privilege to upload files. 

Thanks again for any input.

Marcus.

0
mgpa
5/3/2007 10:23:25 AM

Hi,

Spotted your first mistake; don't use the grid layout, it's "rubbish", form -> properties -> flow layout.  I've seen *some* problems before placing items on the grid and the div for the placed item appears in the wrong place.  I've been using 2005 for so long I forgot that you used to be able to do a grid layout!

Switching to flow layout will mean some additional work to tidy up the GUI, but has two advantages:

1) It works, rather than breaks everything horribly

2) It doesn't use grid layout/absolute positioning, which is just plain nasty.

HTH!
 

0
Mr
5/3/2007 10:46:06 AM

Thanks for your help.

I will give it a go and see what happens!

I have never really liked snap-to-grid type options anyway but the flow control method is going to be a real challenge!

Besides, even with my basic prototype I was finding big differences in representation and functionality between Firefox and IE6.  (IE7 lasted about 2 hours on my laptop before I got rid but that's another story!)

Thanks again

Marcus.
 

0
mgpa
5/3/2007 11:11:43 AM
Reply: