获取按纽文本值!!

沙伽more 2011-06-14 10:33:50

//ItemCreated事件
protected void rptMeuShow_ItemCreated(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
//判断Button是否存在
if (e.Item.FindControl("lbtnMoue") != null)
{
//如果存在,把对象转换为Button。
LinkButton ibtnShow = (LinkButton)e.Item.FindControl("lbtnMoue");
//产生Click事件
ibtnShow.Click += new EventHandler(ibtnShow_Click);
}
}
}

//绑定各类型线路
private void ibtnShow_Click(object sender, EventArgs e)
{
LinkButton lbtnTypeLine = (LinkButton)sender;
anpShow.RecordCount = L_Line.ShowLineCount("", lbtnTypeLine.Text,shopID);
BindLine(lbtnTypeLine.Text, "");
}

private void show()
{
//这个地方我想获得上面方法中lbtnTypeLine 按纽的文本值;请问这个要怎么做啊
}

...全文
71 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
y5681832 2011-06-16
  • 打赏
  • 举报
回复
使用下面的事件
//行绑定事件
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
{
//判断Button是否存在
if (e.Item.FindControl("lbtnMoue") != null)
{
//如果存在,把对象转换为Button。
LinkButton lbtnMoue = (LinkButton)e.Item.FindControl("lbtnMoue");
lbtnMoue.Text = "点击我";
//产生Click事件
lbtnMoue.Click += new EventHandler(lbtnMoue_Click);
}
}

}
酷儿 2011-06-16
  • 打赏
  • 举报
回复
写个 js喽
nuonuo33 2011-06-16
  • 打赏
  • 举报
回复
国际惯例,加我QQ 我传教程给你

62,067

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧