I am new to ASP.NET and I have run into a problem with a page I have created. I have posted the code below. For some reason, I am getting the following error and I don't know enough about ASP yet to even know how to fix it. If someone can take a look at
this and let me know what I'm doing wrong and how to fix it, that would be great. Thanks!
Error:
Compilation Error
Description:
An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30455: Argument not specified for parameter 'e' of 'Public Sub submit(sender As Object, e As System.EventArgs)'.
Source Error:
Line 132: Line 133: #End ExternalSource Line 134: Me.Submit = __ctrl Line 135: __ctrl.ApplyStyleSheetSkin(Me) Line 136:
Source File: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\94e6acce\35d76b3d\App_Web_contact.aspx.cdcab7d2.kwqo6drb.0.vb
Line: 134
-------
This is the code I have for the page:
<%@ Page Title="Contact" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Contact.aspx.vb" Inherits="WebApplication1.About" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script runat="server">
Sub submit(ByVal sender As Object, ByVal e As EventArgs)
name.Text = "Good Morning " & txt1.Text & "!"
End Sub
Sub clear(ByVal sender As Object, ByVal e As EventArgs)
txt1.Text = String.Empty
name.Text = String.Empty
End Sub
</script>
<body>
<h2>
Contact
</h2>
<form id="Form1" runat="server">
Your name: <asp:TextBox id="txt1" runat="server" />
<asp:Button ID="Submit" OnClick="submit" Text="Submit" runat="server" />
<asp:Button ID="Clear" OnClick="clear" Text="Clear" runat="server" />
<p><asp:Label id="name" runat="server" Text="Name" /></p>
</form>
</body>
</asp:Content>
Please move your submit and clear function from the .aspx file to the .vb file. Remove the <script runat server section from it.
Also, please use the visual studio designer feature to see your form displayed graphically and then double click the Submit (please change the name to btnSubmit) and the Clear (change it to btnClear) buttons.
That will create the template for your two functions. And use those templates because I think the error is with the event handler's signature. I mean, the type of the parameters.
If you use the designer then Visual Studio will create those functions for you.
What is the .vb file? This is for an assignment actually and when I showed my professor this code he did not say it needed to be in the .vb file. I had initially received an error because I did not include any function for the clear button so he had said
I needed to do that. Once I did that, it was again giving this error which I have posted. I also don't understand what event handler is... can you explain this further? thanks!
Your problem is your naming conventions. VB is not case sensitive like c# so naming your click handlers the same as your buttons is a big no-no. Try changing your code and remember to be more descriptive in your naming conventions.
<script runat="server">
Sub click_submit(ByVal sender As Object, ByVal e As System.EventArgs)
name.Text = "Good Morning " & txt1.Text & "!"
End Sub
Sub click_clear(ByVal sender As Object, ByVal e As System.EventArgs)
txt1.Text = String.Empty
name.Text = String.Empty
End Sub
</script>
<body>
<h2>
Contact
</h2>
<form id="Form1" runat="server">
Your name: <asp:TextBox id="txt1" runat="server" />
<asp:Button ID="bttnSubmit" OnClick="click_submit" Text="Submit" runat="server" />
<asp:Button ID="bttnClear" OnClick="click_clear" Text="Clear" runat="server" />
<p><asp:Label id="name" runat="server" Text="Name" /></p>
Marked as answer by psha85 on Apr 21, 2010 05:44 PM
Your professor is right about it does not need to be on a .vb file. But what I suggest is to use the Visual Studio or Visual Web Developer tool to see how those programs lay out all the elements for you. And after you understand how everything is connected
then you can try to do it by hand.
But I guess that is not the approach from the professor. So you must follow the directions you find on this thread and try to fix your names and function signatures.
Okay, I changed the code as you had suggested and now I get this error message:
Server Error in '/' Application.
A page can have only one server-side Form tag.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: A page can have only one server-side Form tag.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
psha85
Member
7 Points
37 Posts
please help
Apr 19, 2010 08:09 PM|LINK
Hi-
I am new to ASP.NET and I have run into a problem with a page I have created. I have posted the code below. For some reason, I am getting the following error and I don't know enough about ASP yet to even know how to fix it. If someone can take a look at this and let me know what I'm doing wrong and how to fix it, that would be great. Thanks!
Error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.Compiler Error Message: BC30455: Argument not specified for parameter 'e' of 'Public Sub submit(sender As Object, e As System.EventArgs)'.
Source Error:
Source File: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\94e6acce\35d76b3d\App_Web_contact.aspx.cdcab7d2.kwqo6drb.0.vb Line: 134
-------
This is the code I have for the page:
<%@ Page Title="Contact" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false" CodeBehind="Contact.aspx.vb" Inherits="WebApplication1.About" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <script runat="server"> Sub submit(ByVal sender As Object, ByVal e As EventArgs) name.Text = "Good Morning " & txt1.Text & "!" End Sub Sub clear(ByVal sender As Object, ByVal e As EventArgs) txt1.Text = String.Empty name.Text = String.Empty End Sub </script> <body> <h2> Contact </h2> <form id="Form1" runat="server"> Your name: <asp:TextBox id="txt1" runat="server" /> <asp:Button ID="Submit" OnClick="submit" Text="Submit" runat="server" /> <asp:Button ID="Clear" OnClick="clear" Text="Clear" runat="server" /> <p><asp:Label id="name" runat="server" Text="Name" /></p> </form> </body> </asp:Content>-------
*Pooja*
aderegil
Contributor
3318 Points
593 Posts
Re: please help
Apr 19, 2010 09:52 PM|LINK
Hello,
Please move your submit and clear function from the .aspx file to the .vb file. Remove the <script runat server section from it.
Also, please use the visual studio designer feature to see your form displayed graphically and then double click the Submit (please change the name to btnSubmit) and the Clear (change it to btnClear) buttons.
That will create the template for your two functions. And use those templates because I think the error is with the event handler's signature. I mean, the type of the parameters.
If you use the designer then Visual Studio will create those functions for you.
Does this make sense to you?
psha85
Member
7 Points
37 Posts
Re: please help
Apr 19, 2010 11:35 PM|LINK
What is the .vb file? This is for an assignment actually and when I showed my professor this code he did not say it needed to be in the .vb file. I had initially received an error because I did not include any function for the clear button so he had said I needed to do that. Once I did that, it was again giving this error which I have posted. I also don't understand what event handler is... can you explain this further? thanks!
Das.Sandeep
Star
10652 Points
1897 Posts
Re: please help
Apr 19, 2010 11:42 PM|LINK
Simiar thread:http://forums.asp.net/t/677547.aspx
Please give us feedback no matter whether you get your answer.
Please "Mark as Answer" if it's useful for you.
Regards,
Sandeep
asgradl84
Member
609 Points
113 Posts
Re: please help
Apr 20, 2010 09:25 PM|LINK
Your problem is your naming conventions. VB is not case sensitive like c# so naming your click handlers the same as your buttons is a big no-no. Try changing your code and remember to be more descriptive in your naming conventions.
<script runat="server"> Sub click_submit(ByVal sender As Object, ByVal e As System.EventArgs) name.Text = "Good Morning " & txt1.Text & "!" End Sub Sub click_clear(ByVal sender As Object, ByVal e As System.EventArgs) txt1.Text = String.Empty name.Text = String.Empty End Sub </script> <body> <h2> Contact </h2> <form id="Form1" runat="server"> Your name: <asp:TextBox id="txt1" runat="server" /> <asp:Button ID="bttnSubmit" OnClick="click_submit" Text="Submit" runat="server" /> <asp:Button ID="bttnClear" OnClick="click_clear" Text="Clear" runat="server" /> <p><asp:Label id="name" runat="server" Text="Name" /></p>aderegil
Contributor
3318 Points
593 Posts
Re: please help
Apr 20, 2010 09:40 PM|LINK
Hello again,
Your professor is right about it does not need to be on a .vb file. But what I suggest is to use the Visual Studio or Visual Web Developer tool to see how those programs lay out all the elements for you. And after you understand how everything is connected then you can try to do it by hand.
But I guess that is not the approach from the professor. So you must follow the directions you find on this thread and try to fix your names and function signatures.
psha85
Member
7 Points
37 Posts
Re: please help
Apr 20, 2010 10:46 PM|LINK
Okay, I changed the code as you had suggested and now I get this error message:
Server Error in '/' Application.
A page can have only one server-side Form tag.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Web.HttpException: A page can have only one server-side Form tag.
Source Error:
Stack Trace:
Any suggestions?
*P*
aderegil
Contributor
3318 Points
593 Posts
Re: please help
Apr 20, 2010 10:53 PM|LINK
Look at your aspx code and remove the additional <form tag from the markup because there's only one needed.
See if that is the problem in this case.
psha85
Member
7 Points
37 Posts
Re: please help
Apr 21, 2010 12:36 AM|LINK
I don't see any additional form tag tho... I just see one.. Here is the code.. let me know if you see more than one and which line it's on:
<%@ Page Title="Contact" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false" CodeBehind="Contact.aspx.vb" Inherits="WebApplication1.About" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <script runat="server"> Sub click_submit(ByVal sender As Object, ByVal e As System.EventArgs) name.Text = "Good Morning " & txt1.Text & "!" End Sub Sub click_clear(ByVal sender As Object, ByVal e As System.EventArgs) txt1.Text = String.Empty name.Text = String.Empty End Sub </script> <body> <h2> Contact </h2> <form id="Form1" runat="server"> <p><asp:Label id="name" runat="server" Text="Name" /></p><asp:TextBox id="txt1" runat="server" /> <asp:Button ID="bttnSubmit" OnClick="click_submit" Text="Submit" runat="server" /> <asp:Button ID="bttnClear" OnClick="click_clear" Text="Clear" runat="server" /> </form> </body> </asp:Content>Thanks,
*Pooja*
asgradl84
Member
609 Points
113 Posts
Re: please help
Apr 21, 2010 01:26 AM|LINK
Remove the form tag completely from your aspx page (my fault)
Since you are using a master page the form tag is in your master page and not in your aspx page.