我尝试匹配gridview的值 [英] I try to match value from gridview

查看:56
本文介绍了我尝试匹配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屋!

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