我尝试匹配gridview的值 [英] I try to match value from gridview
问题描述
示例:
// cs
控制控制= null;
control = GridView1.Controls [0] .Controls [0];
string proCode = Convert.ToString((control.FindControl(lblProductCode)as Label).Text);
Label1.Text = proCode;
// aspx
< asp:TemplateField HeaderText =产品代码 >
< itemtemplate>
< asp:Label ID =lblProductCoderunat =serverText ='<%#Eval(productCode) %>'>
< asp:Label ID =Label1runat = serverText =Label>
结果:
对象引用未设置为对象的实例。
如何匹配当前行值?
Example :
//cs
Control control = null;
control = GridView1.Controls[0].Controls[0];
string proCode = Convert.ToString((control.FindControl("lblProductCode") as Label).Text);
Label1.Text = proCode;
//aspx
<asp:TemplateField HeaderText = "Product Code">
<itemtemplate>
<asp:Label ID="lblProductCode" runat="server" Text='<%#Eval("productCode") %>'>
<asp:Label ID="Label1" runat="server" Text="Label">
Result:
Object reference not set to an instance of an object.
how to match the current row value?
推荐答案
这篇关于我尝试匹配gridview的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!