Click to See Complete Forum and Search --> : Code Reuse: Getting errors


Evie
04-02-2007, 02:51 PM
Hi guys!

I am desperately trying to believe all the stuff I read about ASP.NET being the way to go, but time and time again, I keep getting errors I'm not used to getting.

Ok, I'm trying to duplicate a page, but use a different data set. For now, however, I am just simply trying to get the page to work as a duplicate and then go on to change variables, select statements, etc.

Thing is, I'm getting errors.

Ok. I don't know which version the original page was written for, but this is the code:


<asp:datagrid id="dgrdLeasing" runat="server" cellpadding="2" OnUpdateCommand="dgrdLeasing_UpdateItemCommand"
OnCancelCommand="dgrdLeasing_CancelCommand" width="100%" OnEditCommand="dgrdLeasing_EditItemCommand"
OnDeleteCommand="dgrdLeasing_ItemDelete" OnPageIndexChanged="dgrdLeasing_PageIndexChanged"
AllowPaging="True" AllowSorting="True" DataKeyField="LI_ID" AutoGenerateColumns="False" PagerStyle-Mode="NumericPages"
AlternatingItemStyle-BackColor="#cccccc" PageSize="5" BorderWidth="0" BorderColor="White" ShowFooter="True">

It gives me an error saying that it doesn't know what the EditItemCommand is.

Now, the code behind has this:


#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents dgrdLeasing As System.Web.UI.WebControls.DataGrid

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

So, I take out all that dgrListings stuff... JUST to see if it will run.

NOW I'm getting an error saying something hasn't been declared. Now, this page is a cut and paste from another. WHY would I be getting this error? Is there code that I am not aware of that I need to change? (there is also a .resx page that I copied and pasted and simply changed the name of).

In case you aren't familar, I am a noobie at this, so please forgive me if this is something simple and thanks for taking the time to answer.

~ Evie

scoper
04-03-2007, 03:09 AM
It seems that you have copied the aspx page but not the aspx.cs codebehind page.

Evie
04-03-2007, 07:01 AM
It seems that you have copied the aspx page but not the aspx.cs codebehind page.
I did that :( (it is a VB page BTW)