如何主动与主动在GridView中处于非活动状态 [英] how to active & deactive in GridView
问题描述
亲爱的所有人,
我的表格中包含以下字段
商品ID,商品名称,价格,有效期.
此处活动"列仅包含0或1,即
1个可用
0-不可用
在这里,我将此表与Gridview绑定在一起,并在其中具有活动/停用链接"按钮.
加上它,还可以编辑和删除
现在,我的要求是我还需要在Gridview中显示可用项和不可用项,但是不可用项将带有一些浅色..当我单击活动/停用"按钮时,它将处于不可用格式,而编辑和删除"按钮将处于禁用"模式,当用户再次单击正常视图中的活动/停用"按钮以及编辑和删除"按钮时,将启用.
我该怎么做?
Dear All,
I have table with the following fields
Item ID, Item Name, Price, Active.
Here Active column contains only 0 or 1 ie.
1-Available
0-not available
Here I binded this table with Gridview with Active/Deactive link button in it.
with addition of it Edit & Delete also
Now my requirement is I need to show available items & unavailable items also in Gridview but unavailable items will be with some light color.. when i click Active/Deactive button it will be in unavailable format & Edit & Delete buttons will be in Disable mode, When user clicks again Active/Deactive button which will be in normal view & Edit & Delete buttons will be Enabled.
How can i do this?
推荐答案
使用RowDatabound事件来控制控件的可见性或外观,并使用RowCommand事件来执行任何操作.
问候
Praveen
Use RowDatabound event to control visibility or appearance of the controls and RowCommand event to perform any action.
Regards
Praveen
首先更改行颜色
Hi ,
First for change Row Color
GridView1.Rows[1].BackColor = Color.Red;
和用于防止表单编辑
//设置您的条件,就像您将检查Gridview上的某些值一样,如果为true,则不必更新
and For prevent form Editing
//put your condition like you will check on some value on the Gridview and if it true it has to be not update
if (GridView1.Rows[index].Cells[0].Text =="0")
{
GridView1.EditIndex = -1;
}
最好的问候
米特瓦里(M.Mitwalli)
Best Regards
M.Mitwalli
这篇关于如何主动与主动在GridView中处于非活动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!