在DataGrid中怎么点击按钮改变当前行的背景色 有一个DataGrid,在DataGrid中有一个Delete按钮,当点击按钮改变当前行的背景色,在DataGrid的DeleteCommand事件里怎么写???在线急等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 下面的代码是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;"); } } 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;"); } 导出Execl出现问题 奇怪的数据库连接 日期格式转换 treeview的NavigateUrl含有中文的问题 ==>能不能通过XML实现一套自定义上报系统? 请问在绑定的时候如何设置显示的字段长度?? 在datagrid中选择<asp:checkbox>的问题 这样的事件没什么反应 是不是程序的问题 谢谢 大连的朋友看过来 关于jmail的问题,急盼回复 ajax 与 一般处理程序 ,为什么我的一般处理程序触发不了呢? 如何给DetailsView中的字段后添加非空控件? 用户控件怎么调用脚本
下面的代码是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;"); }
}
{ e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#FFFFCC'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;"); }