在详细视图中查找控件 [英] Find control in detail view
本文介绍了在详细视图中查找控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
您能否在下面的详细信息"视图中的查找控件"中帮助我,这是我的CS和ASPX代码.当我运行此代码获取null时,
Hi
could you please help me in Find control in Detail view below is my cs and aspx code.when i run this code getting null
Label compname = DetailsView1.Rows[0].Cells[1].FindControl("complbl") as Label;
comp = compname.Text;
<asp:TemplateField HeaderText="Company Name">
<itemtemplate>
<asp:Label ID="complbl" runat = "server">
</itemtemplate>
谢谢
Thanks
推荐答案
尝试一下,
try this instead,
compname = (Label)DetailsView1.Rows[0].Cells[1].FindControl("complbl");
希望对您有帮助,
谢谢
hope it helps,
thanks
删除为标签,然后尝试以下方式操作我:
remove as Label and try i the following way:
label lbl1 = (Label)DetailsView1.Rows[0].Cells[1].FindControl("complbl"); lable1.Text = lbl1.Text ;
这篇关于在详细视图中查找控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文