光棒效果
//首先判断是否是数据行
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标停留时更改背景色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#d4d0c8'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
//建立满意度图片url column ImageField
DataColumn col = new DataColumn("satisfyImgCol");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i]["satisfy_lvl"].ToString() != "")
{
dt.Rows[i]["satisfyImgCol"] = ResolveUrl("~/image/" + dt.Rows[i]["satisfy_lvl"].ToString() + ".gif");
}
else
{
string str = ResolveUrl("~/image/0.gif");
dt.Rows[i]["satisfyImgCol"] = ResolveUrl("~/image/0.gif");
}
}
//强迫datagrid换行
//this.dataGridView.Attributes.Add("style", "word-break:keep-all;word-wrap:normal"); //普通换行模式
this.dataGridView.Attributes.Add("style", "word-break:break-all;word-wrap:break-word"); //强迫datagrid换行
//打开模式窗体
function test(hid,sid,betime,endtime)
{
window.showModalDialog("DetailByDept.aspx?hid="+hid+"&sid="+sid+"&begintime="+betime+"&endtime="+endtime,'',"dialogHeight:560px;dialogWidth:900px;status:no;");
}
DgvPercent.Rows[this.DgvPercent.Rows.Count - 1].Cells[a*2+1].Attributes.Add("onmouseover", "style.cursor='hand'");
DgvPercent.Rows[this.DgvPercent.Rows.Count - 1].Cells[5].Attributes.Add("onclick", "javascrip:test('0','2','" + beginTime + "','" + endTime + "')");
//显示正确的小数
select to_char(round(6/33*100, 2),'FM9990.00') from dual
select TO_CHAR(round( count(*)/tot*100 , 2 ) ,'FM9990.00')||'%' from dual
dgComoBoxColumn = new DataGridViewComboBoxColumn();
dgComoBoxColumn.DataSource = tempSet.Tables[0];
dgComoBoxColumn.DisplayMember = "DutyName";
dgComoBoxColumn.ValueMember = "DutyId";
dgComoBoxColumn.HeaderText = "出勤情况";
dgvResult.Columns.Insert(4, dgComoBoxColumn);