Tutorial :linq error: CS0102: The type already contains a definition


I am working on a mobile.net project. I am trying to make a list of restaurants which is displayed in a drop down list...whn d user selects an item he can add it to d list of favorites. However I am getting an 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: CS0102: The type 'mobile_rest' already contains a definition for 'emptyChangingEventArgs'    Source Error:    Line 78: {  Line 79:      Line 80:    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);  Line 81:      Line 82:    private int _r_id;  

I have no clue why this is happening... is it because i used d same table in another file too?

Here is my code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Favorite.aspx.cs" Inherits="Favorite" %>  <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>    <html xmlns="http://www.w3.org/1999/xhtml" >  <body>      <mobile:Form id="Form1" runat="server" BackColor="#fcf9f3" Method="get" Paginate="True">            <mobile:Label ID="FaveError" Runat="server" ForeColor="red"               Font-Size="Small" Font-Bold="True" Visible="false" />            <mobile:Label ID="Label2" Runat="server" ForeColor="#d3af63" Font-Italic="True"                   Font-Name="Monotype Covasia" Font-Bold="True" text="Choose Favorite's" />            <mobile:SelectionList ID="listSearch" Runat="server" DataTextfield="r_name"                   DataValueField="r_name" BreakAfter="False">            </mobile:SelectionList>            <mobile:Command ID="btnadd" text="Add" Runat="server" OnClick="btn_add_Click" />            <mobile:list runat="server" id="ListFavorite" DataTextfield="fave_name"               DataValueField="user_id" Font-Size="Small" Font-Italic="True"                Wrapping="Wrap"  BreakAfter="True"/>              <mobile:Command ID="btndelete" text="Delete" Runat="server" OnClick="btn_delete_Click" />        </mobile:Form>  </body>  </html>  

And code behind

using System;  using System.Collections;  using System.ComponentModel;  using System.Data;  using System.Drawing;  using System.Web;  using System.Web.Mobile;  using System.Web.SessionState;  using System.Web.UI;  using System.Web.UI.MobileControls;  using System.Data.Linq;  using System.Xml.Linq;  using System.Linq;    public partial class Favorite : System.Web.UI.MobileControls.MobilePage  {      protected void Page_Load(object sender, EventArgs e)      {          if (Session["error_msg"] != null)          {              FaveError.Text = Session["error_msg"].ToString();              Session["error_msg"] = null;              FaveError.Visible = true;          }            //if (Session["user_id"] = null)          //{          //    Response.Redirect("Login.aspx");          //}          GetRstr();          GetFave();      }        protected void btn_add_Click(object sender, EventArgs e)      {          if (Page.IsValid) // only valid page will proceed          {              AddFave();          }      }        #region add fave      protected void AddFave()      {          String faveitem = listSearch.SelectedIndex;            using (FavoriteDataContext Favorite = new FavoriteDataContext())          {              mobile_favorite mobilefave = new mobile_favorite();              mobilefave.fave_name = faveitem;              mobilefave.user_id = Int32.Parse(Session["user_id"].ToString());              mobilefave.username = Session["user_name"].ToString();                Favorite.mobile_favorites.InsertOnSubmit(mobilefave);              Favorite.SubmitChanges();                Session["error_msg"] = "You have a new favorite";              Response.Redirect("Favorite.aspx");          }      }      

Next Post »