Gridview光棒效果
Gridview光棒效果+点击该行变成另一种颜色,再点该行颜色复原protectedvoidGrid_Vehicle_RowDataBound(objectsender,...
Gridview光棒效果+点击该行变成另一种颜色,再点该行颜色复原
protected void Grid_Vehicle_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onMouseOver", "t=this.style.backgroundColor;this.style.backgroundColor='#ebebce'");
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=t");
e.Row.Attributes.Add("onclick", "if(this.style.backgroundColor=='#ebebce')this.style.backgroundColor=t;else{this.style.backgroundColor='#ebebce'}");
e.Row.Attributes.CssStyle.Add("cursor", "hand");
}
}
我这个添加onclick事件里面的内容该怎么写? 谢谢 展开
protected void Grid_Vehicle_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onMouseOver", "t=this.style.backgroundColor;this.style.backgroundColor='#ebebce'");
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=t");
e.Row.Attributes.Add("onclick", "if(this.style.backgroundColor=='#ebebce')this.style.backgroundColor=t;else{this.style.backgroundColor='#ebebce'}");
e.Row.Attributes.CssStyle.Add("cursor", "hand");
}
}
我这个添加onclick事件里面的内容该怎么写? 谢谢 展开
2个回答
展开全部
不太明白你想要得效果.你是要2中效果察陆把?
1)光棒败蚂顷效果
2) 单击选取,再单击取消选取
如果是这样的话,那么试下一下代码,注意2种效果必须使用不同颜色,否则会失效
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
if (e.Row.RowType == DataControlRowType.DataRow) {
e.Row.Attributes.Add("onMouseOver", "if(this.style.backgroundColor!='#000000'){t=this.style.backgroundColor;this.style.backgroundColor='#ebebce';}");
e.Row.Attributes.Add("onMouseOut", "if(this.style.backgroundColor!='#000000'){this.style.backgroundColor=t;}");
e.Row.Attributes.Add("onclick", "this.style.backgroundColor=this.style.backgroundColor=='#000000'?t:'物缺#000000';");
e.Row.Attributes.CssStyle.Add("cursor", "hand");
}
}
1)光棒败蚂顷效果
2) 单击选取,再单击取消选取
如果是这样的话,那么试下一下代码,注意2种效果必须使用不同颜色,否则会失效
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
if (e.Row.RowType == DataControlRowType.DataRow) {
e.Row.Attributes.Add("onMouseOver", "if(this.style.backgroundColor!='#000000'){t=this.style.backgroundColor;this.style.backgroundColor='#ebebce';}");
e.Row.Attributes.Add("onMouseOut", "if(this.style.backgroundColor!='#000000'){this.style.backgroundColor=t;}");
e.Row.Attributes.Add("onclick", "this.style.backgroundColor=this.style.backgroundColor=='#000000'?t:'物缺#000000';");
e.Row.Attributes.CssStyle.Add("cursor", "hand");
}
}
展开全部
protected void Grid_Vehicle_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick"裤槐汪, "t=this.style.backgroundColor;this.style.backgroundColor='#ebebce'");
e.Row.Attributes.Add("onclick", "this.style.backgroundColor=t");
e.Row.Attributes.Add("onclick", "if(this.style.backgroundColor=='#ebebce')this.style.backgroundColor=t;else{this.style.backgroundColor='明搭#ebebce'胡仔}");
e.Row.Attributes.CssStyle.Add("cursor", "hand");
}
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick"裤槐汪, "t=this.style.backgroundColor;this.style.backgroundColor='#ebebce'");
e.Row.Attributes.Add("onclick", "this.style.backgroundColor=t");
e.Row.Attributes.Add("onclick", "if(this.style.backgroundColor=='#ebebce')this.style.backgroundColor=t;else{this.style.backgroundColor='明搭#ebebce'胡仔}");
e.Row.Attributes.CssStyle.Add("cursor", "hand");
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询