鼠标停留在GridView某一行时颜色改变.txt

鼠标停留在GridView某一行时  行的颜色改变

protected void gvdegreetype_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='GhostWhite'");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
        }
    }



---------------------------------------------



可以选择GRIDVIEW控件,然后双击RowDataBound事件

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//当鼠标移到的时候设置该行颜色为"", 并保存原来的背景颜色
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699CC'");
//当鼠标移走时还原该行的背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
}





----------------

Page.RegisterStartupScript("","<script>  alert('添加数据成功!')</script>");




----------------

现在知道了,只要Page.RegisterStartupScript("","<script>  alert('添加数据成功!')</script>");中把alert改为confirm就行了。 

----------------


麻烦一点你可以加引用  System.Windows.Forms.dll 
  命名空间:  using  System.Windows.Forms.MessageBox; 
  之后使用  MessageBox.Show(); 
  具体你可以查一下MessageBox.Show 
   
  MessageBox.Show("You  must  enter  a  name.",  "Name  Entry  Error", 
  MessageBoxButtons.OK,  MessageBoxIcon.Exclamation  ); 


----------------




Button1.Attributes.Add("onclike","  return  confirm('are  you  sure?')"); 

button.Attributes.Add("onclick",  "return  confirm('文本');");

----------------


Reponse.Write("<script>window.alert('消息')</script>"); 



----------------