Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i alwayes desplay rong
CS1061: 'Class1' does not contain a definition for 'Update_News' and no extension method 'Update_News' accepting a first argument of type 'Class1' could be found (are you missing a using directive or an assembly reference?)

(From the solution that was posted instead of improving question):

Page Class:
C#
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Admin_Control_News : System.Web.UI.Page
{

    public string Path;

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 0;
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        try
{
if (FileUpload1.HasFile && FileUpload1.PostedFile.ContentLength > 0)
{
Path = ("~/Picture/" + FileUpload1.FileName);
FileUpload1.SaveAs(Server .MapPath (Path ));
}
Class1 Add = new Class1();
Add.Add_News(TextBox1.Text, TextBox2.Text, TextBox3.Text,
Path, Convert.ToInt16(TextBox4.Text), CheckBox1.Checked, CheckBox2.Checked); Label1.Text = "تم الحفظ  ";
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
}
catch (Exception ex) {
Label1.Text = ex.Message;
}
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 1;
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        try
{
Label2.Text = "";
Class1 update = new Class1();
if (FileUpload2.HasFile && FileUpload2.PostedFile.ContentLength >
0)
{
Path = ("~/Picture/" + FileUpload2.FileName);
FileUpload2.SaveAs(Server.MapPath(Path));
}
update.Update_News(TextBox5.Text, TextBox6.Text, TextBox7.Text, Path, CheckBox3.Checked, CheckBox4.Checked, DropDownList1.SelectedValue);
DetailsView1.DataBind();
DropDownList1.DataBind();
Label2.Text = "تم التحديث ";
}
catch (Exception ex) {
Label2.Text = ex.Message;
}
}

    protected void Button3_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 2;
    }
}
Posted
Updated 15-Jan-14 10:08am
v2
Comments
Ron Beyer 15-Jan-14 15:49pm    
Please post your code for "Class1" and the lines you are getting this error on. Use the Improve Question link at the bottom right of your question to add it.

You're trying to invoke method Update_News() on an instance of Class1, but you haven't defined that method.  Define the method or remove the call.

/ravi
 
Share this answer
 
Pretty sure your missing a bracket bro.
Checking now gimme 5.

OK way worse, you dont have an "Update_News" function, did you copy someone else's code?

Maybe you could add some better detail?
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900