在list的模板中添加了,一个imageButton的按钮,然后就是单击这个按钮会添加这个人为好友
这个事件是在哪里写 是imagebutton.click里面还是什么的?????和如何获取模板中另外的歌label控件的值??

解决方案 »

  1.   


    //当然在imagebutton.click中写了
    //参考:ImageButton btn= sender as ImageButton ;
    DataListItem  item=btn.parent.parent as DataListItem ;
    label label1= (label)item.FindControl("label1");
    string s=label1.Text; //得到label的值
      

  2.   

    ItemCommand事件中编写代码试下,同时给ImageButton指定CommandName
      

  3.   


    <asp:ImageButton runat="server" id="ibtndelete" commandName="del"></asp:ImageButton>datalist_itemCommand事件里面,通过e.commandName来判断你当前操作的按钮是哪个,并处理时间