使用C#将值分配给gridview内的标签 [英] assign value to label inside the gridview using c#

查看:143
本文介绍了使用C#将值分配给gridview内的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从C#中为网格视图Footer Templete内的标签分配值,请帮帮我



在此先感谢
Meganathan

how to assign a value to label inside the grid view Footer Templete from C# please help me



thanks in advance
Meganathan

推荐答案

亲爱的朋友,

试试这个:-

1).首先在gridview中添加一个标签
Dear Friend,

Try this:-

1). First add a tag inside the gridview
<footertemplate>
  <asp:label id="lblText" runat="server" xmlns:asp="#unknown"></asp:label>
</footertemplate>



2).然后在gridrowdatabound事件中:-



2). Then in the gridrowdatabound event:-

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
  if (e.Row.RowType == DataControlRowType.Footer)
  {
      Label lblText=(Label)e.row.Findcontrol("lblText");
      lblText=[Your Value];
  }
}       



我希望这能够帮到你.如果解决了您的目的,请不要忘记将其标记为您的答案.

谢谢



I hope this helps you out. Don''t forget to mark this as your answer if it solves your purpose.

Thanks


这篇关于使用C#将值分配给gridview内的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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