当网格内部的值不正确时,文本框背景会发生变化 [英] Textbox background change when ircorrect value inside grid

查看:61
本文介绍了当网格内部的值不正确时,文本框背景会发生变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将gridview绑定到datatable,并在gridview中的文本框中显示id。如果id包含任何字符或特殊字符,那么时间文本框背景颜色应为红色。我无法改变文本框的颜色请帮帮我。

I am binding gridview to datatable and id displaying in textbox inside gridview. If id containg any character or special character that time textbox backcolor should be in red color. I am not able to change the color of textbox please help me.

推荐答案

procted void grd_onrowdatabound(object sender,gridviewroweventargs e)

{

IF(e.row.rowtype == DataControlRowType.DataRow)

{

textbox txtpin = e.row.findcontrol(txtpin )作为文本框;

if(txtpin.text ==condition)

{

txtpin.backcolor = system.drawing.color。红色;

}

}

}
procted void grd_onrowdatabound(object sender, gridviewroweventargs e)
{
IF(e.row.rowtype==DataControlRowType.DataRow)
{
textbox txtpin=e.row.findcontrol("txtpin") as textbox;
if(txtpin.text=="condition")
{
txtpin.backcolor=system.drawing.color.red;
}
}
}


这篇关于当网格内部的值不正确时,文本框背景会发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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