您的位置:首页 > 其它

LinkButton及RowCommand事件中获取Gridview中行索引并此行变色

2011-07-21 14:17 309 查看

LinkButton及RowCommand事件中获取Gridview中行索引并此行变色

LinkButton myL = (LinkButton)sender;
int Index = ((GridViewRow)(myL.NamingContainer)).RowIndex;//获得行号
gvManageSuggestion.Rows[Index].RowState = DataControlRowState.Selected;//行的状态
gvManageSuggestion.SelectedRowStyle.BackColor = Color.Gray;//行背景色 //gvManageSuggestion.Rows[Index].Attributes.Add("style ", "BACKGROUND-COLOR:#dddddd ");//行背景色 RowCommand事件中获取行号GridViewRow row=((LinkButton )e.CommandSource).Parent.Parent as GridViewRow;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: