我如何...在c#中的Class1中插入Ubdate_News [英] How do I...where insert Ubdate_News in Class1 in c#

查看:90
本文介绍了我如何...在c#中的Class1中插入Ubdate_News的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i alwayes desplay rong

CS1061:'Class1'不包含'Update_News'的定义,并且没有扩展方法'Update_News'接受类型'Class1'的第一个参数可以找到(是你错过了使用指令或汇编引用吗?)



(从发布的解决方案而不是改进问题):



页面类:

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:

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;
    }
}

推荐答案

您正在尝试调用方法 Update_News() Class1 的实例上,但您尚未定义该方法。 定义方法或删除电话。



/ ravi
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


相当确定你错过了一个括号兄弟。

现在检查gimme 5.



好​​吧,更糟糕的是,你没有Update_News功能,你复制别人的代码吗?



也许你可以添加一些更好的细节?
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?


这篇关于我如何...在c#中的Class1中插入Ubdate_News的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆