views:

644

answers:

1

Hey guys I have a gridview and below it 4 textboxes I'm using to enter data, for styling purposes I'd like to highlight the specific column headers as the user enters/leaves focus on each textbox..

I've been able to highlight the entire row color on focus using:

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

I want to take it a step further now and only highlight certain columns in my header based on whatever textbox I onfocus on.

Can anyone point me to some examples or a good DOM tutorial? I'm pretty horrible with the DOM.

A: 

Solved;

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