I am trying to do simple data entry. I have my aspx file for input and data manager file in App_Code folder to interact with data entity. I have “static” add method but I cant add the model file with “using dataModel” line and cant call the static method in code behind…
What am I missing?
main.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using dataModel; // <------------- cant add this one..gives error
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
dataManager em = new dataManager();
em.add(...)
}
}
dataManager.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class dataManager
{
// Add a new customer
public static void add(...)
{
.
.
.
Static methods are not called on instances. The following will work: