如何在“删除"按钮上更改Gridview行的颜色 [英] How Change the Color of Gridview Row on Delete Button

查看:83
本文介绍了如何在“删除"按钮上更改Gridview行的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

在编写特定要求时,我遇到以下问题:

我需要在运行时将不同的表绑定到一个单一的gridview.此外,gridview应该具有可能的更新,编辑,删除操作.

但是,条件是:

1.在双击网格视图中的特定行(这也意味着,不应有任何用于编辑的链接)时,应进行行的编辑.

2.删除链接应该在Gridview中存在,但是单击该链接时,行中的值不应从database/从gridview中删除.但是,它应该只将特定的行变成红色并禁用. (数据库中不应进行任何更改,例如创建状态列或将记录的状态存储在一行中.)

3. Update链接不存在,因此我们需要在gridview的尾部有一个单独的按钮,以根据所选表更新记录.

4.取消编辑功能应通过在gridview中的任何位置单击鼠标来实现.

注意:我希望删除的项目仅以红色显示".但是,不应在数据库中创建任何新字段来存储状态.因此,可以使用javascript/客户端脚本,但是在回发时(即页面加载后)再次出现问题.现在,我想要这样一种东西,它可以存储行ID或记录在任何数据类型/存储类型中,从那里我可以导出当前值,从而避免回发问题.

请帮忙.

谢谢.

Hello,

I have a following problem in coding a particular requirment:

There is a single gridview to which I need to bind different tables at runtime. Moreover, the gridview should have update, edit, delete operations possible.

However, The conditions are:

1. The editing of row should happen on Double Clicking the particular row (this also means, there should not be any link for Edit) in gridview.

2. The Delete Link Should be there in Gridview, but the on clicking that, the value in rows should not get deleted from database/ from gridview. However, It should just turn that particular row Red in color and as well as disabled. (There should not be any change in database like creating a status column or so to store the status of record in a row.)

3. The Update link is not there, so we need to have seperate button at the bootom of gridview to update the record depending on selected table.

4. The Cancel Editing Function should be achieved by using the Single Click of mouse anywhere in gridview.

Note: I want that the deleted item to be "shown" in red color only. However, no new field should be created in database to store the status or so. So, it is possible using javascript/ Client side scripting but on postback i.e. after page load it again gives problem. Now, I want such thing which will store row ID or record in any datatype/storage type from where I can derive the present values avoiding the postback problem.

Please Help.

Thank You.

推荐答案

请参考一些链接,您肯定会获得一些参考,以继续进行下去:
更改行中颜色ASP.NET中的GridView [在单击时更改GridView行颜色而无需回发 [ ^ ]
如何制作Gridview行颜色/单元格颜色/文本颜色 [更改选定行时gridview行的颜色 [ C#如何在datagridview中更改行颜色 [ ^ ]
根据C#中的条件更改GridView行颜色 [ ^ ]
Please refer some links, you will surely get some reference to move on:
Changing the color of a row in a GridView in ASP.NET[^]
Change the GridView row color on click without postback[^]
How to make a Gridview Row Color/ Cell Color/ Text Color[^]

Similar discussion:
Change the color of gridview row when the row is selected[^]
C# How to change row color in datagridview[^]
Change GridView row color based on condition in C#[^]


这篇关于如何在“删除"按钮上更改Gridview行的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆