有一个DataGrid,在DataGrid中有一个Delete按钮,当点击按钮改变当前行的背景色,在DataGrid的DeleteCommand事件里怎么写???在线急等

解决方案 »

  1.   


    下面的代码是gridview控件的,对datagrid同样有效
    确认代码:
     <asp:TemplateField HeaderText="delete"> 
                     <ItemStyle Width ="32px" />                   
                        <ItemTemplate>                    
                            <asp:ImageButton ID="Ibtndelete" runat="server" ImageUrl="~/images/delete.gif" CommandName="delete" CommandArgument='<%# DataBinder.Eval(Container, "DataItem.id") %>' CausesValidation="false"  OnClientClick="javascript:return confirm('确定删除')" />                        
                        </ItemTemplate>
                    </asp:TemplateField>=========mouse移上当前行改变背景色的代码:
    protected void gvWaitConfirm_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {            e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#FFFFCC'");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");        }
        }
      

  2.   

            if (e.Row.RowType == DataControlRowType.DataRow) 
            {             e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#FFFFCC'"); 
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");         }