怎么在datagrid的footertext中添加一个asp:Linkbutton或实现类似功能呀?

mingshu 2005-09-09 10:34:36
我用asp:Linkbutton在后台cs文件中做了一个事件,本想放进datagrid的footertext中,如FooterText='<asp:LinkButton id="lbtConfirm" runat="server" Visible="Ture">确认</asp:LinkButton>‘,这样可以在datagrid中触发事件,但是不行!而类似footertext=’<a href="www.163.com" >确认</a>‘这样的普通html却可以实现!请各位指点一下!
...全文
88 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
mingshu 2005-09-09
  • 打赏
  • 举报
回复
to fayewang(飞狐):

“如果是Footertemplate的倒数第二列,你就得用一个中间变量记录行数。根据条件满足来添加这个列了
index表示是列数 Cells[0/1/2/3...]类似!!”

请问Footertemplate所属的行数怎么找?应该没有吧!
mingshu 2005-09-09
  • 打赏
  • 举报
回复
tablecell包括Footertemplate里面的cell吗?我倒是可以用datagrid.controls[0].contorls[datagrid.controls[0].contorls.count-1]findcontrol("contorlname")找到里面的控件
fayewang 2005-09-09
  • 打赏
  • 举报
回复
如果是Footertemplate的倒数第二列,你就得用一个中间变量记录行数。根据条件满足来添加这个列了
index表示是列数 Cells[0/1/2/3...]类似!!
mingshu 2005-09-09
  • 打赏
  • 举报
回复
e.Item.Cells.AddAt(int index,addCell);中的index如何确认呢?我是footertemplate的倒数第二列!:)
liuqinglq 2005-09-09
  • 打赏
  • 举报
回复
1楼把我想说的都说完了……

我加一句,1楼的代码要写在ItemCreated事件里
fayewang 2005-09-09
  • 打赏
  • 举报
回复
if(e.Item.ItemType == ListItemType.Pager)
{
TableCell addCell = new TableCell();
addCell.Text = "<asp:LinkButton id='LinkButtonName' runat='server'......>";
e.Item.Cells.AddAt(int index,addCell);
}
fayewang 2005-09-09
  • 打赏
  • 举报
回复
if(e.Item.ItemType == ListItemType.Footer)
{
int x = e.Item.ItemIndex;
DataGrid1.Items[x].Cells.AddAt(0,new TableCell() );
}

62,046

社区成员

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

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

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

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