C#asp.net函数调用的问题?在调用哪里不知道如何写object sender;RepeaterItemEventArgs e;两个变量

被调用的函数
protected int modifyfffff(object sender, RepeaterItemEventArgs e)
{
///获取dropdownlist
///DropDownList list = MainRepe.Items[i].FindControl("JYlist") as DropDownList; int k = list.SelectedIndex;

TextBox id_td = Repeater1.Items[e.Item.ItemIndex].FindControl("txtId") as TextBox;
int id = int.Parse(id_td.Text.ToString());
TextBox name_tb = Repeater1.Items[e.Item.ItemIndex].FindControl("txtName") as TextBox;
string name = name_tb.Text;
Response.Write(name);
TextBox des_tb = Repeater1.Items[e.Item.ItemIndex].FindControl("txtDes") as TextBox;
string des = des_tb.Text;
TextBox price_tb = Repeater1.Items[e.Item.ItemIndex].FindControl("txtPrice") as TextBox;
decimal price = decimal.Parse(price_tb.Text.ToString().Trim());

int pp = new manaBLL().modify(id, name, des, price);
return pp;
}

protected int modifyfffff(object sender, RepeaterItemEventArgs e)

如果在这个方法里面没有用到sender,和e变量的话,那么就随便写了
protected int modifyfffff(new object(), new RepeaterItemEventArgs());就可以了!!
我不知道你这个是什么控件的事件,我给你举个例子你就知道了
比如我有个名字叫Btn_Demo的按钮,他有一个点击事件如下:
private void Btn_Demo_Clike(object sender,EventArgs e)
{
MessageBox.Show(“你好!”);

}

在别的地方想调用这个方法的话你就直接这样调用:
private void Btn_Demo_Clike(Btn_Demo,new EventArgs());
就可以了,object sender一般指向控件或对象本身, RepeaterItemEventArgs e 你就new一个对象给他就是了1!追问

protected int modifyfffff(RepeaterItemEventArgs e)
{
///内容省略,太多了不能显示,谢谢
}
没懂起,直接说,这个方法 如何在pageload 调用

追答

上面回答的说的很清楚了啊,

追问

等等,先看一看,报错了

追答

大哥,有2个参数啊!!
protected int modifyfffff(Sender, new RepeaterItemEventArgs());

温馨提示:答案为网友推荐,仅供参考
相似回答