查询Gridview文本框 [英] Query for Gridview Textbox
本文介绍了查询Gridview文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友,
如何在Textbox控件的TextChanged事件中找到Gridview内的Checkbox控件..... Checkbox和Textbox都在gridview内.
只是我必须在该行的TextChanged事件上找到该行的相关复选框.
回复朋友!
问候,
aamir
hi friends,
how can i find the Checkbox control which is inside the Gridview on TextChanged event of Textbox control.....the Checkbox & Textbox both are inside the gridview.
only that i have to find the related checkbox of that row on TextChanged event in that Row.
reply frnds!
Regards,
aamir
推荐答案
在textchanged事件中编写以下代码
write below code in textchanged event
GridViewRow row=(sender as TextBox).NamingContainer
此属性为您提供该文本框所在的行.
this property gives you row where this textbox is present.
是的,我尝试过位于Gridview控件内部的Textbox的TextChanged事件. 以下是我的代码:
yes i have tried on the TextChanged event of the Textbox which is Inside the Gridview control
below is my code:
protected void txtenddate_TextChanged(object sender, EventArgs e)
{
try
{
TextBox txtEndate = ((TextBox)(sender));
GridViewRow grv = ((GridViewRow)(txtEndate.NamingContainer));
CheckBox chkgoing = (CheckBox)GridDetails.Rows[0].FindControl("chkOngoing");
if (txtEndate.Text != "")
{
chkgoing.Enabled = false;
}
}
catch (Exception ex)
{
}
}
但是我没有得到复选框,我必须禁用....只要txtEndate文本框中有值
请回复
but i am not getting the Checkbox whic i have to disable....whenever there is value in the txtEndate textbox
pl reply,
这篇关于查询Gridview文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文