我用编程的方法动态生成了table,现在想给每一个table增加一个onMouseOver="SetIndex(1)"的方法。
在html里面直接可以这样写<table  onMouseOver="SetIndex(1)">
但是我是动态生成的表格,在程序里应该怎样给table添加这个事件呢?

解决方案 »

  1.   

    编程的方法动态生成了table,Table 是怎么生成的,事件就怎么生成,
      

  2.   

    我的Table是用语句生成的
    for(int i=0;i<4;i++)
    {
    Table tb=new Table();
    ……
    }
    在生成的页面的代码都是<table>……</table>
    我现在想让他变成<table onMouseOver="SetIndex(1)">……</table>
    那在生成table的语句应该怎么样改。
    谢谢!
      

  3.   

    Table tb=new Table();
    tb.Attributes.Add("onMouseOver", "SetIndex(1)")
      

  4.   

    Table tb=new Table();
    tb.Attributes.Add("onMouseOver", "SetIndex(1)"); //pay attention to here