如何在“删除链接"按钮上更改Datagrid行的颜色在Datagrid中单击

编程入门 行业动态 更新时间:2024-10-27 21:24:32
本文介绍了如何在“删除链接"按钮上更改Datagrid行的颜色在Datagrid中单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨 我有一个DataGrid,需要在单击Datagrid中的Delete LinkBut​​ton时更改datagrid中行的颜色. 请帮忙. 谢谢.

Hi I am having a DataGrid and need to change the color of the row in datagrid on clicking the Delete LinkButton in Datagrid. Please help. ThanKs.

推荐答案

您可以通过在网格行的链接按钮的onClick上注入Javascript函数来执行以下操作. 要注入JS,您需要使用GridView的RowDataBound,如下所示: You can do the following by Injecting Javascript function on onClick of link button for a grid row. For injecting JS, you need to use RowDataBound of GridView, something like: protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e) { DataControlRowType rtype = e.Row.RowType; if (rtype == DataControlRowType.DataRow && rtype != DataControlRowType.Footer && rtype != DataControlRowType.Separator && rtype != DataControlRowType.Header && rtype != DataControlRowType.Pager) { // Highligh row on click of row e.Row.Attributes.Add("onclick", "Highlight(this);"); } }

针对任何事件(如鼠标悬停或链接按钮单击等)进行修改. 试试吧!

Modify it for any event like mouseover or link button click, etc. Try!

更多推荐

如何在“删除链接"按钮上更改Datagrid行的颜色在Datagrid中单击

本文发布于:2023-11-11 10:10:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1578130.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   按钮   颜色   链接   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!