0

こんにちは、グリッドビューがあり、その下にデータを入力するために使用している 4 つのテキスト ボックスがあります。スタイリングの目的で、ユーザーが各テキスト ボックスにフォーカスを移動/移動するときに、特定の列ヘッダーを強調表示したいと思います。

次を使用して、フォーカス時に行全体の色を強調表示できました。

<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+"')");
    }
}

さらに一歩進んで、フォーカスしているテキストボックスに基づいて、ヘッダーの特定の列のみを強調表示したいと思います。

誰かが私にいくつかの例や良いDOMチュートリアルを教えてもらえますか? 私はDOMでかなり恐ろしいです。

4

1 に答える 1

0

解決済み;

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+"')");
于 2009-06-26T14:29:24.387 に答える