I had taken over some code that was originally created .net 1.1 We need to update and bring into .net 2.0, so I opened the solution in VS2008 and went through the converter wizard.
Now, when I am trying to build the solution, I am seeing the below error for all elements (buttons, text boxes, etc...) on all of my aspx pages:
ASP.ar_comments_aspx' does not contain a definition for 'btnSave_Click' and no extension method 'btnSave_Click' accepting a first argument of type 'ASP.ar_comments_aspx' could be found (are you missing a using directive or an assembly reference?)
AR Comments.aspx
<%@ Page language="c#" Codebehind="AR Comments.aspx.cs" AutoEventWireup="True" Inherits="CollectionsComments.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>AR Comments</title>
<meta name="vs_showGrid" content="True">
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout" background="BlueBackground.gif" bgProperties="fixed">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="txtComments" style="Z-INDEX: 101; LEFT: 184px; POSITION: absolute; TOP: 96px"
runat="server" Width="608px" Height="344px" TextMode="MultiLine" Font-Size="X-Small" MaxLength="5000"
tabIndex="1" Font-Names="Arial"></asp:TextBox>
<asp:Button id="btnSave" style="Z-INDEX: 102; LEFT: 248px; POSITION: absolute; TOP: 448px" runat="server"
Height="28" Width="70px" Text="Save" tabIndex="2" Font-Names="Arial" Font-Size="X-Small" onclick="btnSave_Click"></asp:Button>
<asp:Button id="btnCancel" style="Z-INDEX: 103; LEFT: 648px; POSITION: absolute; TOP: 448px"
runat="server" Height="28" Width="70px" Text="Cancel" tabIndex="4" Font-Names="Arial" Font-Size="X-Small" onclick="btnCancel_Click"></asp:Button>
<asp:Button id="btnClear" style="Z-INDEX: 104; LEFT: 448px; POSITION: absolute; TOP: 448px"
tabIndex="3" runat="server" Height="28px" Width="70px" Text="Clear" Font-Names="Arial" Font-Size="X-Small" onclick="btnClear_Click"></asp:Button>
<asp:Label id="Label1" style="Z-INDEX: 105; LEFT: 184px; POSITION: absolute; TOP: 72px" runat="server"
Font-Names="Arial" Font-Size="14pt" Height="5px" Width="100%" Font-Bold="True" Font-Italic="True">AR Report Comments</asp:Label>
</form>
</body>
</HTML>
However, as you can see below there is bnSave_Click method for the page...
namespace CollectionsComments
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public partial class WebForm1 : System.Web.UI.Page
{....
protected void btnSave_Click(object sender, System.EventArgs e)
{
string strCommentsWritten = this.txtComments.Text.ToString();
// This replace command allows for apostrophes in the comments by doubling them up
// which doesn't break the string in the SQL statement
strCommentsWritten = strCommentsWritten.Replace("'", "''");
// Limit comments to 5000 characters
if (strCommentsWritten.Length >5000)
{
strCommentsWritten = strCommentsWritten.Remove(5000,(strCommentsWritten.Length - 5000));
}
// Set UPDATE statement
string strSqlSelect;
strSqlSelect = "update dw_collections set ar_comm = '" + strCommentsWritten +
"', ar_mod_dt = '" + System.DateTime.Today.ToShortDateString() + "', ar_mod_usr = '" +
strUser + "' where clnum = '" + strClient + "' and tkinit = '" + strInitials + "'";
// Set connection information
string strElite = "server=xxx;uid=xxx;pwd=xxx;database=xxx
System.Data.SqlClient.SqlConnection myConnection = new System.Data.SqlClient.SqlConnection(strElite);
// Make connection
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandType = CommandType.Text;
myCommand.CommandText = strSqlSelect;
myConnection.Open();
// Execute Update Statement
myCommand.ExecuteReader();
// Clean up
myCommand = null;
myConnection = null;
// Go back to report
Response.Redirect(strReturnAddress);
}
Is there something that I'm overlooking from the conversion? I just can't seem to figure out what the issue is. Any assistance that you could provide would be extremely helpful.
Thanks