c#
  • asp.net
  • javascript
  • coding-style
  • client-side
  • 2009-06-26 18 views 0 likes 
    0

    嗨我有一个GridView和它下面4个文本框,我使用的输入数据,对造型的目的,我想突出具体列标题作为用户进入/离开专注于每一个文本框..OnFocus文本框更改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+"')"); 
        } 
    } 
    

    我希望把它更进了一步,现在,只有突出某些根据我所关注的任何文本框在我的标题中添加列。

    任何人都可以给我一些例子或一个很好的DOM教程?我非常害怕DOM。

    回答

    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+"')"); 
    
    相关问题