通过JavaScript在SetFocusedRowIndex(-1)之后更改DevExpress GridView行背面颜色
我在我的通过JavaScript在SetFocusedRowIndex(-1)之后更改DevExpress GridView行背面颜色,javascript,asp.net,gridview,devexpress,client-side-scripting,Javascript,Asp.net,Gridview,Devexpress,Client Side Scripting,我在我的ASPxGridView中有一个JavaScipt为FocusedRowChanged提供的客户端函数。 在这个函数中,我将gvMore.GetFocusedRowIndex()发布到我的CallBackPanelPerformCallback。 我将FocusedRowIndex保存到ri变量中(var ri=gvMore.GetFocusedRowIndex();) 然后移除行的焦点(gvMore.SetFocusedRowIndex(-1);) 现在,如何在SetFocusedRo
ASPxGridView
中有一个JavaScipt为FocusedRowChanged
提供的客户端函数。
在这个函数中,我将gvMore.GetFocusedRowIndex()
发布到我的CallBackPanel
PerformCallback
。
我将FocusedRowIndex
保存到ri变量中(var ri=gvMore.GetFocusedRowIndex();
)
然后移除行的焦点(gvMore.SetFocusedRowIndex(-1);
)
现在,如何在SetFocusedRowIndex(-1)之后更改GridView
行[ri]
颜色代码>
function OnGridFocusedRowChanged() {
if (gvMore.GetFocusedRowIndex() > -1)
CallBackPanel_FindPlcyCar.PerformCallback(gvMore.GetFocusedRowIndex());
var ri = gvMore.GetFocusedRowIndex();
gvMore.SetFocusedRowIndex(-1);
// *???*
}
什么JavaScript代码是必要的???线路
请回答这里,不要重定向到另一个链接我请
非常感谢您可以使用
OnHtmlRowPrepared="gvMore_HtmlRowPrepared"
在ASPxGridview标记处的aspx文件上,并在cs文件上按如下方式实现它:
public protected gvMore_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e)
{
e.Row.Attributes.Add("id",e.Row.RowIndex.ToString());
}
在客户端,您可以更改/???放弃
document.getElementById(ri).style.Background = "#122334"
或者任何你想要的颜色。
我没有执行代码,可能有更多的细节,但这就是要点。最后我使用allowrowselect而不是allowrowfocus。
然后单击“客户端事件”。
和e.visibleIndex在RowClick客户端事件中。
allowrowselect会更改背景色本身。您尝试过什么吗?结果如何?最后我用allowrowselect代替allowrowfocus。然后单击“客户端事件”。