问题与网格视图有关 [英] question realated to gridview
本文介绍了问题与网格视图有关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用下拉列表在gridview中设置状态为活动和非活动我希望当用户
设置状态激活gridview行颜色变为绿色并且当用户选择deActive gridview roe颜色变为红色
i我使用了很多代码,但没有任何代码正常工作请帮助我
i am setting status active and deactive in gridview using dropdownlist i want when user
set status active gridview row color became green and when user select deActive gridview roe color became red
i am using many code but no any code is working please help me
推荐答案
试试这个..
If(DDL.SelectedItem.Text ==Active)
{
// callRowDataBound();
}
在您的databoundevent中添加此代码..
Try this..
If(DDL.SelectedItem.Text == "Active")
{
// callRowDataBound();
}
add this code in your databoundevent..
if (e.Row.RowType == DataControlRowType.DataRow)
{
DateTime dtdate = DateTime.ParseExact(e.Row.Cells[1].Text, "dd/MM/yyyy", null);
if (dtdate == DateTime.Now.Date)
{
e.Row.BackColor = Color.FromName("#00B5D0");
}
}}
试试这个gridview活动: -
try this gridview event:-
protected void Gridview1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.Row.Cells[4].Text == "Active") //change your link button column index
{
e.Row.BackColor = ColorTranslator.FromHtml("#C2DAEC");
}
else
{
e.Row.BackColor = ColorTranslator.FromHtml("#ECE0C2");
}
}
这篇关于问题与网格视图有关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文