日期:2014-05-17  浏览次数:20495 次

有关datalist的问题
鼠标点击datalist怎么获当前行的值,我以前用gridview做过会做
C# code

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string name = e.Row.Cells[0].Text.Trim();
                e.Row.Attributes.Add("onclick ", " window.returnValue='" + name + "';window.close();"); 
                if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState ==    DataControlRowState.Alternate)
                {
                    //鼠标经过时,行背景色变
                    e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA'");
                    //鼠标移出时,行背景色变
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#DEDFDE'");
                }
            }
        }


但是用datalist不知道用鼠标点击怎么获取当前行的值,请指教。。

------解决方案--------------------
document.getElementById(this).innerHTML
------解决方案--------------------
???对了得到他干什么啊,给谁啊