ONFOCUSテキストボックスには、GridViewのヘッダーのフォントを変更しますか?
-
20-08-2019 - |
質問
やあみんな、私は、GridViewコントロールを持っていると私は、ユーザーが入力として/葉は、各テキストボックスに焦点を当て、私は特定の列ヘッダーを強調したいスタイリングの目的のために、データを入力するために使用しています..
私が使用してフォーカスに行全体の色を強調することができました。
<script language="javascript">
function headerRoll(id) {
document.getElementById(id).style.color = 'yellow';
}
</script>
&&
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
string id = "row" + e.Row.RowIndex.ToString();
e.Row.Attributes.Add("id", "row" + e.Row.RowIndex);
descrTxt.Attributes.Add("OnFocus", "headerRoll('"+id+"')");
}
}
私は上のONFOCUSどんなテキストボックスに基づいて、私のヘッダー内の特定の列を強調表示し、今だけさらに一歩それを取るしたいと思います。
誰もがいくつかの例や優れたDOMのチュートリアルに私を指すことができますか?私は、DOMとかなり恐ろしいです。
解決
解決しました。
string id = "cell0";
//e.Row.Attributes.Add("id", "row" + e.Row.RowIndex);
e.Row.Cells[0].Attributes.Add("id", "cell0");
descrTxt.Attributes.Add("OnFocus", "headerRoll('"+id+"')");
所属していません StackOverflow