我asp.net的两个方法如下: void ButtonList1_BtnOnClick(object sender, EventArgs e)//一组按钮
{
switch ((sender as Button).CommandArgument)
{
case "add":
this.Add();
//就想在这里调用aa_click()方法的”edit“选项。
break;
case "save":
break;
case "del":
this.Delete();
break;
}
}protected void aa_Click(object sender, EventArgs e)//是GridView的一个模板列的一个按钮事件
{
GridViewRow curRow = (GridViewRow)((sender as LinkButton).Parent.Parent);
switch ((sender as LinkButton).CommandName)
{
case "edit":
this.GridView1.EditIndex = curRow.RowIndex;
ind = curRow.RowIndex;
this.ViewState["FID"] = curRow.Cells[1].Text;
break;
case "update":
break;
case "cancel":
break;
}
}
请问第一个方法的"add"里,如何调用aa_Click()里的“edit”事件啊?
{
switch ((sender as Button).CommandArgument)
{
case "add":
this.Add();
//就想在这里调用aa_click()方法的”edit“选项。
break;
case "save":
break;
case "del":
this.Delete();
break;
}
}protected void aa_Click(object sender, EventArgs e)//是GridView的一个模板列的一个按钮事件
{
GridViewRow curRow = (GridViewRow)((sender as LinkButton).Parent.Parent);
switch ((sender as LinkButton).CommandName)
{
case "edit":
this.GridView1.EditIndex = curRow.RowIndex;
ind = curRow.RowIndex;
this.ViewState["FID"] = curRow.Cells[1].Text;
break;
case "update":
break;
case "cancel":
break;
}
}
请问第一个方法的"add"里,如何调用aa_Click()里的“edit”事件啊?
解决方案 »
- vs2010将不再集成最新版asp.net ajax. Microsoft Ajax Library将从ASP.NET独立出来!
- 急..........求救.... .net放在虚拟空间的子目录下有问题....
- 请教COLOR对象
- 求一超难算法:H01LZ010101CB01LF02MN01QB01T010W13701 求这一编码分几级? 详细说明如下......
- 驗證控件的验证时间问题
- [讨论]我认为应该这样学习.NET 。。。
- 请教关于treeview的右键弹出菜单的"小"问题(大问题已解决)!
- 有劳思归看看,MyWebClient.DownloadFile问题
- asp.net 实现网站模拟登陆,高分求助!
- 再发一遍……
- 我的简历怎么人才网上会没有人联系我,难道简历有问题?
- 没办法了,找大家帮忙。。
{
switch ((sender as Button).CommandArgument)
{
case "add":
this.Add();
LinkButton l=new LinkButton();
l.CommandName="edit";
aa(l);
//就想在这里调用aa_click()方法的”edit“选项。
break;
case "save":
break;
case "del":
this.Delete();
break;
}
}protected void aa_Click(object sender, EventArgs e)//是GridView的一个模板列的一个按钮事件
{
aa(sender);
}
private void aa(object sender)
{ GridViewRow curRow = (GridViewRow)((sender as LinkButton).Parent.Parent);
switch ((sender as LinkButton).CommandName)
{
case "edit":
this.GridView1.EditIndex = curRow.RowIndex;
ind = curRow.RowIndex;
this.ViewState["FID"] = curRow.Cells[1].Text;
break;
case "update":
break;
case "cancel":
break;
}
}
---------------------
瞎扯, 什么是 "事件", 什么是" 委托 "? 知道不?你的 ButtonList1_BtnOnClick 何 aa_Click 就是两个再普通不过的方法而已
看看书和例子吧,说不太清楚。我自己也不是很明白。