如果条件为真,如何突出grigview中的列? [英] How to highlight the column in grigview if the condition is true?
问题描述
使用从雇员表中选择的数据填充网格视图
SrNo
EmpCode
name
地址
DOJ
如果一名员工已经完成了5年的工作任期,他将有资格获得资助,为此,我们需要在gridview中有一个栏目有资格获得资助
,其值为''YES''或''NO''
如果值为''是',则突出显示该列。
我完成上述问题以保存员工的详细信息
但是我不知道如何将这些记录放在gridview中并编辑和删除从网格视图中记录
以及我不知道如何突出gridview中的列?
populate a grid view with data selected from table employessss having colums
SrNo
EmpCode
name
Address
DOJ
If an employee has completed his 5 years tenure of working he will be eligible for grantity and for this we need to have a column in gridview "Eligible for grantity"
with the value ''YES'' or ''NO''
If the value is ''Yes'' highlight that column.
I complete above question upto save the details of employee
but I dont no how place those records inside gridview and edit and delete record from grid view
along with i dont how to highlight the column in gridview?
推荐答案
您好,
对于行突出显示使用gridview的以下事件,
protected void gridView1_RowDataBound(object sender ,GridViewRowEventArgs e)
{
if(eR ow.RowType == DataControlRowType.DataRow)
{
if(Convert.ToInt32(e.Row.Cells [8] .Text)> 5)
{
e.Row.Style.Add(HtmlTextWriterStyle.Color,red);
}
}
}
如需更新,请删除以下内容,
1. http://www.aspdotnet-suresh .com / 2011/02 / how-to-inserteditupdate-and-delete-data.html [ ^ ]
2. http://csharpdotnetfreak.blogspot.com/2009/05/gridview-sqldatasource-insert-edit.html [ ^ ]
Hi,
For Row highlight use the following event of the gridview,
protected void gridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (Convert.ToInt32(e.Row.Cells[8].Text) > 5)
{
e.Row.Style.Add(HtmlTextWriterStyle.Color, "red");
}
}
}
For Update, delete try the following,
1. http://www.aspdotnet-suresh.com/2011/02/how-to-inserteditupdate-and-delete-data.html[^]
2. http://csharpdotnetfreak.blogspot.com/2009/05/gridview-sqldatasource-insert-edit.html[^]
这篇关于如果条件为真,如何突出grigview中的列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!