1.use client script in the aspx page
2.use validator control
3.write client script by codebehind,for example there is a button named button1you can write the code ***button1.attribute("onclick")="javascript:alert('aaa')" in the cs file

解决方案 »

  1.   

    不好意思,我的意思室在DATAGRID的DELE方法中如何实现弹出一个确认删除窗口!
      

  2.   

    那就在他的DELE事件函加一个确诊窗口不就行了吗?
      

  3.   


    Response.Write ("<Script>");
    Response.Write ("alert('是否删除?')");
    Response.Write ("</Script>");
      

  4.   

    知道了,但我在用Visual Studio生成的DataGrid,的那些编辑,删除按键怎么调用在那里写它们啊??!
    我加分就是了!!
      

  5.   

    再datagrid的onItemDataBound事件里面加入如下代码private void EventData_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if (e.Item.ItemIndex >= 0) 
    {
    LinkButton btn = (LinkButton)e.Item.Cells[10].FindControl("Linkbutton2");
    btn.Attributes.Add("onClick","javascript:return confirm('确定要删除该条记录吗?');");           
    }      
    }
      

  6.   

    e.Item.Cells[10]值得是“删除”的LinkButton所在的datagrid单元格
    10是索引号
      

  7.   

    btn.Attributes.Add("onClick","javascript:return confirm('确定要删除该条记录吗?');"); 
    出现如下错误
    未将对象引用设置到对象的实例。
      

  8.   

    首先,确定你的方法是用来处理datagrid德onItemDataBound事件的
    然后,确定你的“删除”的linkbutton所在的列的索引号和你程序中的是否  一致,假如你有10列,“删除”在最后一列,则索引号为9
    最后,确定你的“删除”连接的id和你findcontrol()里面的参数是否一致
    LinkButton btn = (LinkButton)e.Item.Cells[10].FindControl("Linkbutton2"); 这里,“删除”按钮德id是Linkbutton2在我这里运行一些正常
      

  9.   

    请问 killerwc
    如何得到返回的是“确定”还是“取消”
      

  10.   

    谢了!
    实在是不知道findcontrol()里面的参数是什么啊!!
    到那里找啊!