现在的位置: 首页 > 综合 > 正文

可以双击的DataGrid

2012年10月24日 ⁄ 综合 ⁄ 共 492字 ⁄ 字号 评论关闭

可以选中和双击的DataGrid十分容易实现,而且选中行时能够无刷新。
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {
   int index = e.Item.ItemIndex;
   if(index>-1)
   {
    string idValue = index.ToString();
    e.Item.Attributes.Add("ondblclick","window.open(\"test.aspx?id="+idValue +"\")");
    e.Item.Attributes.Add("onMouseOver","this.bgColor='pink';this.style.cursor='hand';");
    e.Item.Attributes.Add("onMouseOut","this.bgColor='#ffffff';this.style.cursor='default';");
   }
  }

抱歉!评论已关闭.