编程语言

img redlotoc

datagrid触发javascript事件

发表于2004/10/22 15:04:00  650人阅读

 触发javascript事件
        public static void DG_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {
   LinkButton l=new LinkButton();
   if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem )
   {
    l = (LinkButton)e.Item.Cells[0].FindControl("del");
    l.Attributes.Add("onclick", "return Delete();");
   }
     } 
//DataGrid里面的超联接打开一个窗口: 
<a href=“javascript:;” onclick='window.open("Finance_viewContract.aspx?OrderItemID=<%# DataBinder.Eval(Container.DataItem,"OrderitemID")%>&ContractID=<%# DataBinder.Eval(Container.DataItem,"orditemContractID")%>","null","width=350,height=350")'>
            <asp:Label ID=labcontractid Runat=server Text='<%# DataBinder.Eval(Container.DataItem,"orditemContractID")%>'>
            </asp:Label>
           </a>
阅读全文
0 0

相关文章推荐

img
取 消
img