<asp:GridView ID="GridView1" runat="server" Style="z-index: 100; left: 10px; position: absolute;
top: 204px" Width="659px">
<Columns>
<asp:TemplateField HeaderText="卡片名称">
<ItemTemplate>
<asp:Label id="CardName" runat="server">
</asp:Label>
</ItemTemplate>
想得到Lable控件的ID。顺便给他赋值。 Label lb = Page.FindControl("GridView1").FindControl("CardName") as Label;
Label lb=this.Findcontrol("CardName") as Lable
错误。: 未将对象设置到对象实例。 空指针异常。 在线等。 求解
top: 204px" Width="659px">
<Columns>
<asp:TemplateField HeaderText="卡片名称">
<ItemTemplate>
<asp:Label id="CardName" runat="server">
</asp:Label>
</ItemTemplate>
想得到Lable控件的ID。顺便给他赋值。 Label lb = Page.FindControl("GridView1").FindControl("CardName") as Label;
Label lb=this.Findcontrol("CardName") as Lable
错误。: 未将对象设置到对象实例。 空指针异常。 在线等。 求解
解决方案 »
- return confirm 添加出错
- int i = int.Parse(com.ExecuteNonQuery().ToString());
- asp.net的blog和论坛大家用什么?
- 麻烦高手进来帮我一下,谢谢
- 30分挑战,实现javascript取datagrid的值
- 带checkbox的treecview怎么样得到点击checkbox的那个node呢??
- ????如何取DataGrid某一列的所有值??
- 我的DataGrid有一列是LinkButton,我怎样使得点击该LinkButton的时候,它所在的行的背景色改变?
- 水晶报表求教
- asp.net 编程遇到DataGrid查询问题,大家帮帮我~~~~{vb.net}
- .NET V1.1发邮件,如何自定义发件人?在线等
- linkButton 各位高手帮我解决一下
这样查找i是行索引 看你找哪行的了
绝对没有问题
{
Label mc = (Label)(GridView.Rows[i].FindControl("CardName"));
}
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
Lable lable1=e.Row.FindControl("lable1") as Lable ;
}
}
还是不行啊~~mc一直为null